Skip to content

Releases: rmnldwg/lymph

1.3.2

31 Jan 16:03
8c91098
Compare
Choose a tag to compare

What's New

Bug Fixes

  • __init__() without named_params now works. Previously, it raised an exception
    because the distribution composite was not initialized.

Testing

  • __init__() with named_params must work.

1.3.1

31 Jan 13:43
d96189f
Compare
Choose a tag to compare

What's New

Bug Fixes

  • get_named_params() returns only named params and doesn't raise an error anymore.
  • Add deleter to named_params property.

Change

  • Move named_params stuff from dedicated mixin to types.Model.
  • Raise explicit invalid param name error.
    This ensures that e.g. during sampling, the likelihood does not simply
    return -np.inf because it sees a ValueError.
  • Call set_named_params() in likelihoods.
    This ensures that a model definition is respected during inference and
    also when reloading sampled parameters. In case no named_params are
    provided, this will simply behave as set_params().

1.3.0

29 Jan 15:32
4d641c1
Compare
Choose a tag to compare

What's New

The main two new features of this release are the HPV model (thanks @YoelPH for this) and the ability to only set a subset of parameters. See #95 for an explanation why that was necessary.

No breaking changes this time (phew).

Bug Fixes

  • (hpv) Some renaming and import correct symbols.
  • (hpv) Send kwargs to constructor correctly.
  • Partial globals work in set_named_params().
    Setting ipsi_spread via named_params works now. This was tricky to
    implement, as the spread params of the ipsi model are all called
    ipsi_<something>_spread.

Documentation

  • Fix typos in readme.
  • Fix typo in midline model docstring.
  • Fix equation in midline model docstring.
  • Change ref to "bilateral" in HPV model.
  • Add new mixins to autodoc.
  • Add warning about untested HPV model.

Features

  • (hpv) Create HPV wrapper.
    The HPV module can be used to build a unilateral lymph model
    where the b_2 parameter is different for HPV positive patients.
    This fixes #42
  • (uni) Add basic working named params mixing. Related to #95
  • Add named_params to all models. Fixes #95
  • Add named_params to model constructors. Related to #95

Testing

  • Add basic tests for NamedParamsMixin. Related to #95
  • Check partial globals work.
    E.g. ipsi_spread should set the spread of all LNLs in the ipsi
    model. Related to #95

Change

  • (mid) Set default use_central=False.
    This is a more sane default and does not result in a ValueError when
    creating the model with the default arguments.
  • (hpv) Put data split into HPV class.
  • (hpv) Delegate methods via hpv_status arg.
    Instead of re-implementing or copy-pasting methods from the Unilateral
    class, they simply compute those model's corresponding method that was
    selected via the hpv_status (keyword) argument.

1.2.3

26 Jul 07:55
27d5206
Compare
Choose a tag to compare

What's New

This is very minor and I only release this tiny update, so that I can depend on all models having the binary and trinary constructor in lyscripts.

Features

  • (mid) Add missing binary constructor to Midline model. Now all models have a binary and trinary constructor.

Styling

  • Add rules to ruff.

Testing

  • Make suite testable with pytest.

Ci

  • Switch to pytest for testing.

1.2.2

25 Jun 13:23
38ec139
Compare
Choose a tag to compare

What's New

Bug Fixes

  • (mid) Correct contra state dist evo. Fixes #85.
    Previously, the model did not correctly marginalize over the possible
    time when a tumor can grow over the midline. It simply assumed that it
    did from the onset.

Documentation

  • (uni) Remove outdated docstring paragraph. Fixes #88.

Miscellaneous Tasks

  • Bump pre-commit versions.

Styling

  • Use ruff to fix lint and format code.

Build

  • Remove upper cap in deps.

Change

  • risk() meth requires involvement. Fixes #87.
    We figured it does not make sense to allow passing involvement=None
    into the risk() method just to have it return 1. This is except for
    the midline class, where involvement may reasonably be None while
    midext isn't.
    Also, I ran ruff over some files, fixing some code style issues.

1.2.1

28 May 13:40
473b4e3
Compare
Choose a tag to compare

Changelog

All notable changes to this project will be documented in this file.

What's New

Bug fixes and two tiny features.

Bug Fixes

  • (uni) load_patient_data should accept None.
  • (mid) Correct type hint of marginalize.
  • (graph) Wrong dict when trinary.
    The to_dict() method returned a wrong graph dictionary when trinary
    due to growth edges. This is fixed now.
  • Skip marginalize only when safe.
    The marginalization should only be skipped (and 1 returned), when the
    entire disease state of interest is None. In the midline case, this
    disease state includes the midline extension.
    Previously, only the involvement pattern was checked. Now, the model is
    more careful about when to take shortcuts.

Features

  • (graph) Modify mermaid graph.
    The get_mermaid() and get_mermaid_url() methods now accept arguments
    that allow some modifications of the output.
  • (uni) Add __repr__().

Refactor

  • (uni) Use pandas map instead of apply.
    This saves us a couple of lines in the load_patient_data method and is
    more readable.

Merge

  • Branch 'main' into 'dev'.

Remove

  • Remains of callbacks.
    Some callback functionality that was tested in a pre-release has been
    forgotten in the code base and is now deleted.

1.2.0

29 Mar 12:57
b7f453a
Compare
Choose a tag to compare

What's New

This feature update brings methods to the models that allow a more modular use of them. Otherwise, nothing spectacular.

Bug Fixes

  • (mid) obs_dist may return 3D array.

Documentation

  • Fix unknown version in title.
  • Add missing blank before list.
  • (mid) Add comment about midext marginalizing.

Features

  • (mid) Add posterior_state_dist() method.
    The Midline model now has a posterior_state_dist() method, too.
  • (types) Base Model has state dist methods.
    Both state_dist() and posterior_state_dist() have been added to the
    types.Model base class.
  • Add marginalize() method.
    With this new method, one can marginalize a (prior or posterior) state
    distribution over all states that match a provided involvement.
    It is used e.g. to refactor the code of the risk() methods.
  • (types) Add obs_dist and marginalize.
    The types.Model base abstract base class now also has the methods
    obs_dist and marginalize for better autocomplete support in editors.

Testing

  • Remove plain test risk.

Change

  • (types) Improve type hints for inv. pattern.
  • Rename "diagnose" to "diagnosis" when noun.
    When used as a noun, "diagnosis" is correct, not "diagnose".

Full diff: 1.1.0...1.2.0

1.1.0

20 Mar 17:19
6559f11
Compare
Choose a tag to compare

What's New

With this feature update, it becomes possible to speed up repeated risk predictions by providing it with precomputed state distributions. These state distributions are the most expensive part of most models.

Features

  • (utils) Add safe_set_params() function.
    This checks whether the params are a dict, list, or None and handles
    them accordingly. Just a convencience method that helped refactor some methods.
  • Allow to pass state distributions to posterior_state_dist() and risk() methds. Fixes #80.
    With this, one can use precomputed state distributions to speed up
    computing the posterior or risk for multiple scenarios.

Refactor

  • Use safe_set_params() across models.

Testing

  • Add checks for midline risk. Related #80.
  • (mid) Fix wrong assumption in risk test.

Full Changelog: 1.0.0...1.1.0

1.0.0

18 Mar 16:49
Compare
Choose a tag to compare

Finally 🎉

Eventually, I did manage to decide on an API that I want to stick with for the foreseeable future.

If you have used the previous version 0.4.3, then forget everything you knew about that and head over to the documentation to learn everything from scratch. The core concepts stay the same though.

Full diff since last release candidate: 1.0.0.rc2...1.0.0
Full diff since 0.4.3: 0.4.3...1.0.0

Bug Fixes

  • (uni) Catch error when apply to empty data. Fixes #79.
    For some reason, using apply on an empty DataFrame has an entirely
    different return type than when it is not empty. This caused the issue
    #79 and has now been fixed.
  • (bi) Data reload loads wrong side.
    Now the data does not get reloaded anymore, which was actually
    unnecessary in the first place.
  • (uni) Return correctly in get_spread_params.
  • (mid) Consume & return params in same order.
  • (uni) Allow mapping=None when loading data.

Testing

  • (uni) Check if loading empty data works. Related #79.
  • (uni) Make sure likelihood is deterministic.

Change

  • BREAKING (uni) Shorten two (unused) method names.
  • BREAKING helpers are now utils.
  • (type) Add type definition for graph dict.
  • (diag) Use partials to save parametric dist.

1.0.0.rc2

06 Mar 10:33
ecdfc54
Compare
Choose a tag to compare
1.0.0.rc2 Pre-release
Pre-release

What's New

Implementing the lymixture brought to light a shortcoming in the way the data and diagnose matrices are computed and stored. As mentioned in issue #77, their rows are now aligned with the patient data, which may have some advantages for different use cases.

Also, since this is probably the last pre-release, I took the liberty to go over some method names once more and make them clearer.

All changes: 1.0.0.rc1...1.0.0.rc2

Bug Fixes

  • Don't use fake T-stage for BN model. Related #77.
    Since we now have access to the full diagnose matrix by default, there
    is no need for the Bayesian network T-stage fix anymore.
  • (uni) Reload data when modalities change.
    Because we only store those diagnoses that are relevant to the model
    under the "_model" header in the patient_data table, we need to reload
    the patient data whenever we modify the modalities.

Documentation

  • Update to slightly changed API.
  • (bi) Add bilateral quickstart to docs.

Features

  • (mod) Add utils to check for modality changes.

Performance

  • (uni) Make data & diagnose matrices faster. Related #77.
    The last change caused a dramatic slowdown (factor 500) of the data and
    diagnose matrix access, because it needed to index them from a
    DataFrame. Now, I implemented a basic caching scheme with a patient
    data cache version that brought back the original speed.
    Also, apparently del dataframe[column] is much slower than
    dataframe.drop(columns). I replaced the former with the latter and now
    the tests are fast again.

Refactor

  • BREAKING Rename methods for brevity & clarity.
    Method names have been changed, e.g comp_dist_evolution() has been
    renamed to state_dist_evo() which is both shorter and (imho) clearer.
  • (uni) Move data/diag matrix generation.

Testing

  • Update to slightly changed API.
  • (uni) Check reset of data on modality change.
    Added a test to make sure the patient data gets reloaded when the
    modalities change. This test is still failing.
  • Finally suppress all PerformanceWarnings.

Change

  • BREAKING Store data & diagnose matrices in data. Fixes #77.
    Instead of weird, dedicated UserDicts, I simply use the patient data
    to store the data encoding and diagnose probabilities for each patient.
    This has the advantage that the entire matrix (irrespective of T-stage)
    is aligned with the patients.
  • BREAKING (bi) Shorten kwargs.
    The (uni|ipsi|contra)lateral_kwargs in the Bilateral constructor
    were shortened by removing the "lateral".

Merge

  • Branch 'main' into 'dev'.
  • Branch '77-diagnose-matrices-not-aligned-with-data' into 'dev'.

Remove

  • Unused helpers.