Giter Club home page Giter Club logo

bmds's People

Contributors

bishwobhandari avatar dannypeterson avatar hausman-gdit avatar rabstejnek avatar shapiromatron avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

liuduan

bmds's Issues

cutoff-value range

The allowable range for the BDM cutoff-value on benchmarkdose.com only works for increasing dose-response data because of the code

 if not domain[0] < self.adversity_value < domain[1]:
                raise ValueError(
                       'Adversity value not in allowable domain: {} ({} - {})'
                       .format(self.adversity_value, domain[0], domain[1]))

in base.py. Instead

 if not min(domain) < self.adversity_value < max(domain):
                raise ValueError(
                       'Adversity value not in allowable domain: {} ({} - {})'
                       .format(self.adversity_value, min(domain), max(domain))

might work?
Thanks.

add word reporting feature to session and model

  • Add a new word reporting method to https://github.com/shapiromatron/bmds/blob/main/bmds/bmds3/sessions.py (or subclass parent if exists) so that a session can generate a word report.
  • Make each bmds3 model able to generate a word report on itself, using the outputs from its to_dict method. Much of the code for the various tables are already available here, https://github.com/shapiromatron/bmds-server/pull/62/files; hopefully we can remove most of the content from the bmds-server and move here
  • Make each bmds3 model able to plot a matplotlib plot of itself, and embed in the docx report too
  • ensure that the current "Download report" button in the webserver still works with the new code
  • write a bmds unit test that generates a word report as well to bake in our testing (may not need to test much, just ensure it doesnt break)
  • bonus - make the table generation a bit quicker by calculating the appropriate table dimensions before building instead of inserting rows

Much of the reporting code currently is an MVP; feel free to revise, tune, and restructure (and built common helper methods if the same patterns are repeated).

Issue loading library

Successfully installed on Ubuntu 18.10:-

Successfully installed bmds-0.10.0 python-docx-0.8.7 simple-settings-0.13.0

This is what I get on loading the library:-

Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bmds
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/bmds/__init__.py", line 6, in <module>
    from .session import * # noqa
  File "/usr/local/lib/python2.7/dist-packages/bmds/session.py", line 126
    async def execute_models(self):
            ^
SyntaxError: invalid syntax

Any ideas?

1 validation error for DatasetMetadata

When running the code from the README documentation with pydantic version > 2, an error occurs.
Traceback (most recent call last):
File "/Users/eric/3bms/test.py", line 4, in
dataset = bmds.DichotomousDataset(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/eric/3bms/.venv/lib/python3.11/site-packages/bmds/datasets/dichotomous.py", line 44, in init
self.metadata = DatasetMetadata.parse_obj(metadata)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/eric/3bms/.venv/lib/python3.11/site-packages/typing_extensions.py", line 2360, in wrapper
return arg(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/Users/eric/3bms/.venv/lib/python3.11/site-packages/pydantic/main.py", line 1010, in parse_obj
return cls.model_validate(obj)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/eric/3bms/.venv/lib/python3.11/site-packages/pydantic/main.py", line 503, in model_validate
return cls.pydantic_validator.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for DatasetMetadata

new word report options

Add additional word report options at the session and batch level:

The options should be as follows:

  1. dataset_format_long: bool=True - should data be written in long format? #58
  2. verbose_model_outputs:bool = False - if True, all output models are written (the current case). If False (the new default), only write outputs for the frequentist selected model, if one exists. For bayesian, if this is False, then individual model outputs will not be reported
  3. bmd_cdf_table: bool=False - should the cdf table be printed for each model? If true, show the CDF table (percentile and BMD), otherwise do not print table (default)

implement model recommendation logic for bmds3

Model recommendation logic and rules already existing for bmds2, but it's likely that the current implementation is tuned specifically to the outputs from bmds2 which are structured differently than bmds3.

Investigate what needs to be done to update the bmds.logic package so that it works for both bmds2 and bmds3. If it makes sense, it would be fine to move the existing logic into bmds.bmds2.logic, and start fresh with bmds.bmds3.logic. Do what is most efficient based on developer time; bmds2 code will likely be used very little in the future so future maintenance of bmds3 code is more important than compatibility with bmds2.

The decision logic can be modified by a user when setting up a session; the default logic can be found in the "payload" variable in this notebook: https://github.com/shapiromatron/bmds-server/blob/main/scripts/bmds-online-33-api.ipynb

Acceptance criteria: A set of unit tests can be written for executing new bmds3 modeling and recommendation logic can be applied. The tests should demonstrate both using default recommendation logic (aka, nothing is specified), as well as custom logic (for example, disabling a test or changing comparison values, etc). For now, we can focus exclusively on dichotomous models when testing.

Related work:

Our goal here is to build all models for saving the rules using Pydantic so we can serialize and deserialize the logic provided by the user.

Word report updates

Based on recent user feedback on the existing word reports:

  • change all input datasets to be in current long form, where one row for each dose/response (keep existing code, but add another option "long=True" where if True, the new behavior, and if False, the current "wide" format)
  • add a CDF plot for each model, just like what's reported on the web view; add to write_models method

Update docx report to show text-output for individual model outputs

In addition to showing docx tables for individual model outputs, show a complete text-output report for each model.

To do this, update the bmds/bmds3/types/dichotomous:DichotomousResult object and add a new text() method which constructs a full text report from the data in the tbl() method for the parent object and child objects.

Update word report to print continuous individual model dataset table

Consistent with 143, update word report to print individual datasets using a group by for the dataset.

To develop/test:

from pathlib import Path

import bmds

cids = bmds.ContinuousIndividualDataset(
    doses=[
        0, 0, 0, 0, 0, 0, 0, 0,
        0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
        1, 1, 1, 1, 1, 1,
        10, 10, 10, 10, 10, 10,
        100, 100, 100, 100, 100, 100,
        300, 300, 300, 300, 300, 300,
        500, 500, 500, 500, 500, 500,
    ],
    responses=[
        8.1079, 9.3063, 9.7431, 9.781, 10.052, 10.613, 10.751, 11.057,
        9.1556, 9.6821, 9.8256, 10.2095, 10.2222, 12.0382,
        9.5661, 9.7059, 9.9905, 10.2716, 10.471, 11.0602,
        8.8514, 10.0107, 10.0854, 10.5683, 11.1394, 11.4875,
        9.5427, 9.7211, 9.8267, 10.0231, 10.1833, 10.8685,
        10.368, 10.5176, 11.3168, 12.002, 12.1186, 12.6368,
        9.9572, 10.1347, 10.7743, 11.0571, 11.1564, 12.0368
    ]
)

session = bmds.session.Bmds330(dataset=cids)
session.add_model(bmds.constants.M_Power)
session.execute_and_recommend()
docx = session.to_docx()
docx.save(Path("~/Desktop/bmds3-batch.docx").expanduser())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.