Recent Releases of lymph-model
lymph-model - 1.3.6
What's New
This release changes nothing about the actual code. Only the way it's built and tested. So, purely a maintenance update.
Miscellaneous Tasks
- Update pre-commit & ruff rules.
Testing
- Update one doctest example.
Build
- Switch to
srclayout. Fixes #106. - Rename opt dependencies to
tests. - Use tests dependency
pytest-covovercoverage.
Ci
- Update pre-commit config.
- Python
Published by rmnldwg 11 months ago
lymph-model - 1.3.5
What's new:
Bug Fixes
- Assign only tumor spread probs in midline.
- (mid) Warn instead of raise when out of sync. Fixes [#102].
Documentation
- Fix release badge in README.
- Fix outdated links to rmnldwg.
Testing
- Ensure midline params sync.
- Add failing midline params desync. Related [#102].
- Fix desync test case.
Build
- Add git-cliff to dev dependencies.
- Python
Published by YoelPH 12 months ago
lymph-model - 1.3.4
What's New
Bug Fixes
- Don't use
orwhen param may be 0.\ Since Python's expressiona = b or cwill assignctoaas soon asbis "falsy", e.g. also whenb = 0.0, I should not use this to check if a parameter in the model isNone.
Documentation
- Fix misspelled repo link.
- Remove empty mixins page.
- Better reuse of README.
- Move social card to repo root.\ This is actually for LyProX: I want to display the social card of all repos in the lycosystem on LyProX's landing page. Therefore, they all need to be in their expected places.
Miscellaneous Tasks
- Add year range to license.
Testing
- Use val != 0.5 to test matrix deletion.\ 0.5 is the new initial value for most parameters, so it does not make sense to use this to check if upon changing a parameter, the transition matrix gets deleted.
Change
- Init most params with 0.5 instead of 0.0.\ In some cases, initializing with 0.0 may have unintended consequences. E.g., a probability of 0.0 cannot be renormalized.
Ci
- Use OIDC for publishing.
- Python
Published by rmnldwg about 1 year ago
lymph-model - 1.3.3
What's New
Bug Fixes
- Make
midext_problast param in get/set methods - Midline musn't use last of
set_paramargs.\ Instead, it should use the one atnum_dims - 1.
Documentation
- Fix broken quickstart link.
- Add
emceeto requirements for quickstart notebook. - Explain midline extension probability in set/get.
Testing
midext_probis last parameter in get/set methods.
- Python
Published by rmnldwg about 1 year ago
lymph-model - 1.3.2
What's New
Bug Fixes
__init__()withoutnamed_paramsnow works. Previously, it raised an exception because the distribution composite was not initialized.
Testing
__init__()withnamed_paramsmust work.
- Python
Published by rmnldwg over 1 year ago
lymph-model - 1.3.1
What's New
Bug Fixes
get_named_params()returns only named params and doesn't raise an error anymore.- Add deleter to
named_paramsproperty.
Change
- Move
named_paramsstuff from dedicated mixin totypes.Model. - Raise explicit invalid param name error.\
This ensures that e.g. during sampling, the likelihood does not simply
return
-np.infbecause it sees aValueError. - Call
set_named_params()in likelihoods.\ This ensures that a model definition is respected during inference and also when reloading sampled parameters. In case nonamed_paramsare provided, this will simply behave asset_params().
- Python
Published by rmnldwg over 1 year ago
lymph-model - 1.3.0
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().\ Settingipsi_spreadvianamed_paramsworks now. This was tricky to implement, as thespreadparams of theipsimodel are all calledipsi_<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
HPVmodule 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_paramsto all models. Fixes #95 - Add
named_paramsto model constructors. Related to #95
Testing
- Add basic tests for
NamedParamsMixin. Related to #95 - Check partial globals work.\
E.g.
ipsi_spreadshould set thespreadof all LNLs in theipsimodel. Related to #95
Change
- (mid) Set default
use_central=False.\ This is a more sane default and does not result in aValueErrorwhen creating the model with the default arguments. - (hpv) Put data split into HPV class.
- (hpv) Delegate methods via
hpv_statusarg.\ Instead of re-implementing or copy-pasting methods from theUnilateralclass, they simply compute those model's corresponding method that was selected via thehpv_status(keyword) argument.
- Python
Published by rmnldwg over 1 year ago
lymph-model -
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
binaryconstructor toMidlinemodel. Now all models have abinaryandtrinaryconstructor.
Styling
- Add rules to ruff.
Testing
- Make suite testable with pytest.
Ci
- Switch to pytest for testing.
- Python
Published by rmnldwg almost 2 years ago
lymph-model -
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 requiresinvolvement. Fixes #87.\ We figured it does not make sense to allow passinginvolvement=Noneinto therisk()method just to have it return 1. This is except for the midline class, whereinvolvementmay reasonably beNonewhilemidextisn't.\ Also, I ran ruff over some files, fixing some code style issues.
- Python
Published by rmnldwg almost 2 years ago
lymph-model -
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_datashould acceptNone. - (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
marginalizeonly when safe.\ The marginalization should only be skipped (and 1 returned), when the entire disease state of interest isNone. 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()andget_mermaid_url()methods now accept arguments that allow some modifications of the output. - (uni) Add
__repr__().
Refactor
- (uni) Use pandas
mapinstead ofapply.\ This saves us a couple of lines in theload_patient_datamethod 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.
- Python
Published by rmnldwg about 2 years ago
lymph-model -
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_distmay 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.\ TheMidlinemodel now has aposterior_state_dist()method, too. - (types) Base
Modelhas state dist methods.\ Bothstate_dist()andposterior_state_dist()have been added to thetypes.Modelbase 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 therisk()methods. - (types) Add
obs_distandmarginalize.\ Thetypes.Modelbase abstract base class now also has the methodsobs_distandmarginalizefor 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: https://github.com/rmnldwg/lymph/compare/1.1.0...1.2.0
- Python
Published by rmnldwg about 2 years ago
lymph-model -
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()andrisk()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: https://github.com/rmnldwg/lymph/compare/1.0.0...1.1.0
- Python
Published by rmnldwg about 2 years ago
lymph-model -
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: https://github.com/rmnldwg/lymph/compare/1.0.0.rc2...1.0.0 Full diff since 0.4.3: https://github.com/rmnldwg/lymph/compare/0.4.3...1.0.0
Bug Fixes
- (uni) Catch error when
applyto empty data. Fixes #79.\ For some reason, usingapplyon an emptyDataFramehas 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=Nonewhen 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
helpersare nowutils. - (type) Add type definition for graph dict.
- (diag) Use partials to save parametric dist.
- Python
Published by rmnldwg about 2 years ago
lymph-model -
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: https://github.com/rmnldwg/lymph/compare/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 `patientdata` 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, apparentlydel dataframe[column]is much slower thandataframe.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 tostate_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_kwargsin theBilateralconstructor were shortened by removing the "lateral".
Merge
- Branch 'main' into 'dev'.
- Branch '77-diagnose-matrices-not-aligned-with-data' into 'dev'.
Remove
- Unused helpers.
- Python
Published by rmnldwg about 2 years ago
lymph-model -
What's New
This release hopefully represents the last major change before releasing version 1.0.0. It was necessary because during the implementation of the midline model, managing the symmetries in a transparent and user-friendly way became impossible in the old implementation.
Now, a composite pattern is used for both the modalities and the distributions over diagnose times. This furhter separates the logic and will allow more hierarchical models based on the ones provided here to work seamlessly almost out of the box. This may become relevant with the mixture model.
Big thanks to @YoelPH for implementing large parts of the midline model! 👏🏻
The full diff can be found here: https://github.com/rmnldwg/lymph/compare/1.0.0.a6...1.0.0.rc1
Add
- Midline module added. This makes the code now feature complete again (compared to version 0.4.3). It also implements the evolution of the midline extension as random variable.
Bug Fixes
- (diag) Delete frozen distributions when params change.
- (diag) Correct max time & params.\
The
max_timeis now correctly accessed and set. Also, the distribution params are not used up by synched distributions, but only by the distributions in composite leafs. - (graph) Avoid warning for micro mod setting.
- ⚠ BREAKING Make likelihood work with emcee again.\ The way the likelihood was defined, it did not actually play nicely with how the emcee package works. This is now fixed.
- (bi) Fix uninitialized
is_symmetricdict. - (mid) Add missing dict in init.
- (mid) Update call to
transition_matrix()&state_list. - (mid) Finish
draw_patientsmethod.\ Some bugs in the method for drawing synthetic patients from theMidlinewere fixed. This seems to be working now.
Documentation
- (mid) Improve midline docstrings slightly.
- Go over
set_params()docstrings. - Update quickstart guide to new API.
- Adapt tests to new API (now passing).
- Update index & fix some docstrings.
- Fix some typos and cross-references.
Features
- (helper) Add
popfirst()andflatten().\ Two new helper function in relation to getting and setting params. - (type) Add model ABC to inherit from.\ I added an abstract base class from which all model-like classes should inherit. It defines all the methods that need to be present in a model.\ The idea behind this is that any subclass of this can be part of a composite that correctly delegates getting/setting parameters, diagnose time distributions, and modalities.
- ⚠ BREAKING (graph) Add
__hash__to edge, node, graph.\ This replaces the dedicatedparameter_hash()method. - (mod) Add method to delete modality
del_modality(). - Add more get/set params methods.
- (mid) Implement
set_params. - (mid) Implement the
load_patient_datameth. - (mid) Finish midline (feature complete).
- Complete set/get methods on model classes.\
The
Unilateral,Bilateral, andMidlinemodel now all have the six methodsset_tumor_spread_params,set_lnl_spread_params,set_spread_params,set_params,get_tumor_spread_params,get_lnl_spread_params,get_spread_params, andget_params. - (mid) Reimplement the midline evolution.\ The midline evolution that Lars Widmer worked on is now reimplemented. However, although this implementation is analogous to the one used in previsou version of the code and should thus work, it is still untested at this point.
- Add helper to draw diagnoses.\
The new helper function
draw_diagnosesis a re-implementation of theUnilateralclass's method with the same name for easier reusing. - (mid) Allow marginalization over unknown midline extension.\
This is implemented differently than before: If data with unknown
midline extension is added, it gets loaded into an attribute named
unknown, which is aBilateralmodel only used to store that data and generate diagnose matrices.
Miscellaneous Tasks
- Move timing data.
- Make changelog super detailed.
Refactor
- (mid) Split likelihood method.
Testing
- Fix long-running test.
- Add integration tests with emcee.
- Add checks for bilateral symmetries.
- (mid) Add first check of
set_params()method. - (mid) Check likelihood function.
Add
- Added doc strings.
Change
- Non-mixture midline implemented.\ fixed the non mixture midline extension model and added documentation
- ⚠ BREAKING Make
get_params()uniform and chainable.\ The API of allget_params()methods is now nice and uniform, allowing arbitrary chaining of these methods. - ⚠ BREAKING Make
set_params()uniform and chainable.\ The API of allset_params()methods is now nice and uniform, allowing arbitrary chaining of these methods. - ⚠ BREAKING Make
set_params()not return kwargs.\ It does make sense to "use up" the positional arguments one by one in theset_params()methods, but doing the same thing with keyword arguments is pointless, difficult and error prone. - ⚠ BREAKING (graph) Replace
namewithget_name().\ In theEdgeclass, thenameproperty is replaced by a functionget_name()that is more flexible and allows us to have edge names without underscores when we need it. - ⚠ BREAKING (bi) Reintroduce
is_symmetricattribute.\ This will once again manage the symmetry of theBilateralclass's different ipsi- and contralateral attributes. - ⚠ BREAKING (diag) Use composite for distributions.\
Instead of a dict that holds the T-stages and corresponding
distributions over diagnose times, this implements them as a composite
pattern. This replaces the dict-like API entirely with methods. This has
several advantages:
- It is more explicit and thus more readable
- The composite pattern is designed to work naturally with tree-like structures, which we have here when dealing with bilateral models.
- ⚠ BREAKING (mod) Use composite for modalities.\
Instead of a dict that holds the names and corresponding
sens/spec for diagnostic modalities, this implements them as a composite
pattern. This replaces the dict-like API entirely with methods. This has
several advantages:
- It is more explicit and thus more readable
- The composite pattern is designed to work naturally with tree-like structures, which we have here when dealing with bilateral models.
- ⚠ BREAKING (uni) Transform to composite pattern.\ Use the new composite pattern for the distribution over diagnose times and modalities.
- (bi) Update for new composite API.
- ⚠ BREAKING (mod) Shorten to sens/spec.\
Also, add a
clear_modalities()and aclear_distributions()method to the respective composites. - (matrix) Use hashables over arg0 cache.\
Instead of using this weird
arg0_cachefor the observation and transition matrix, I use the necessary arguments only, which are all hashable now. - ⚠ BREAKING Adapt risk to likelihood call signature.
- (type) Add risk to abstract methods.
- (type) Abstract methods raise error.
Merge
- Branch 'yoel-dev' into 'dev'.
- Branch '74-synchronization-is-unreadable-and-error-prone' into 'dev'. Fixes #74.
- Branch 'main' into 'dev'.
- Branch 'add-midext-evolution' into 'dev'.
Remove
- Unused helper functions.
- Python
Published by rmnldwg about 2 years ago
lymph-model -
What's New
With this (still alpha) release, we most notably fixed a long unnoticed bug in the computation of the Bayesian network likelihood.
Bug Fixes
- (uni) Leftover
kwargsnow correctly returned inassign_params() - ⚠ BREAKING (uni) Remove
is_<x>_sharedentirely, as it was unused anyways. Fixes #72. - T-stage mapping may be dictionary or callable
- (uni) Raise exception when there are no tumors or LNLs in graph
Documentation
- Fix typo in modalities
Testing
- (uni) Check constructor raises exceptions
- Check the Bayesian network likelihood
Change
- (uni) Trinary params are shared by default
- (uni) Prohibit setting
max_time - ⚠ BREAKING Change
likelihood()API: We don't allow setting the data via thelikelihood()anymore. It convoluted the method and setting it beforehand is more explicit anyways.
- Python
Published by rmnldwg over 2 years ago
lymph-model -
What's New
In this alpha release we fixed more bugs and issues that emerged during more rigorous testing.
Most notably, we backed away from storing the transition matrix in a model's instance. Because it created opaque and confusion calls to functions trying to delete them when parameters were updated.
Instead, the function computing the transition matrix is now globally cached using a hash function from the graph representation. This has the drawback of slightly more computation time when calculating the hash. But the advantage is that e.g. in a bilateral symmetric model, the transition matrix of the two sides is only ever computed once when (synched) parameters are updated.
Bug Fixes
- (graph) Assume
nodesis dictionary, not a list. Fixes #64 - (uni) Update
draw_patients()method to output LyProX style data. Fixes #65 - (bi) Update bilateral data generation method to also generate LyProX style data. Fixes #65
- (bi) Syntax error in
init_synchronization. Fixes #69 - (uni) Remove need for transition matrix deletion via a global cache. Fixes #68
- (uni) Use cached matrices & simplify stuff. Fixes #68
- (uni) Observation matrix only property, not cached anymore
Documentation
- Fix typos & formatting errors in docstrings
Features
- (graph) Implement graph hash for global cache of transition matrix
- (helper) Add an
arg0cache decorator that caches based on the first argument only - (matrix) Use cache for observation & diagnose matrices. Fixes #68
Miscellaneous Tasks
- Update dependencies & classifiers
Refactor
- Variables inside
generate_transition()
Testing
- Make doctests discoverable by unittest
- Update tests to changed API
- (uni) Assert format & distribution of drawn patients
- (uni) Allow larger delta for synthetic data distribution
- (bi) Check bilateral data generation method
- Check the bilateral model with symmetric tumor spread
- Make sure delete & recompute synced edges' tensor work
- Adapt tests to changed
EdgeAPI - (bi) Evaluate transition matrix recomputation
- Update tests to match new transition matrix code
- Update trinary unilateral tests
Change
- ⚠ BREAKING Compute transition tensor globally. Fixes #69
- ⚠ BREAKING Make transition matrix a method instead of a property. Fixes #40
- ⚠ BREAKING Make observation matrix a method instead of a property. Fixes #40
Ci
- Add coverage test dependency back into project
Remove
- Unused files and directories
- Python
Published by rmnldwg over 2 years ago
lymph-model -
What's New
Again, thanks to @YoelPH for finding (and coming up with solutions to fix) some critical bugs, especially w.r.t. the trinary model. Below is a list of notable changes since the last pre-release.
Bug Fixes
- Use
lnls.keys()consistently everywhere - Warn about symmetric params in asymmetric graph
- Make
allowed_statesaccessible - Provide
basekeyword argument tocompute_encoding(). This is necessary for the trinary model (see #45) - Ensure confusion matrix of trinary diagnostic modality has correct shape
- Make diagnostic encoding always binary
- Correct joint state/diagnose matrix (fixes #61)
- Send kwargs to both
assign_paramsmethods (fixes #60) - Enable two-way sync between lookup dicts (fixes #62)
Documentation
- Add "see also" to get/set methods, thereby making them reference each other
Features
- Add trinary & keywords in encoding: When computing the risk for a certain pattern in a trinary model, one may now provide different kewords like
"macro"to differentiate between different involvements of interest. - Add convenience constructors to create
binaryandtrinarybilateral models - Allow bilateral model with an asymmetric graph structure
- Add get/set methods to
DistributionsUserDict, which makes allget_params()andset_params()methods consistent across their occurences
Refactor
- Pull initialization of ipsi- & contralateral models out of
Bilateralmodel's__init__() - Restructure
Bilateralmodel's__init__()method slightly
Testing
- Cover bilateral risk computation
- Cover unilateral risk method
- Check asymmetric model implementation
- Check binary/trinary &
allowed_states - Add trinary likelihood test
- Add risk check for trinary model
- Add checks for delegation of attrbutes & setting of params
- Check
cached_propertydelegation works - Check param assign thoroughly
Change
- Don't use custom subclass of
cached_propertythat forbids setting and use the defaultcached_propertyinstead - Encode symmetries of
Bilateralmodel in a special dict calledis_summetricwith keys"tumor_spread","lnl_spread", and"modalities"
- Python
Published by rmnldwg over 2 years ago
lymph-model -
What's New
Fourth alpha release. @YoelPH noticed some more bugs that have been fixed now. Most notably, the risk prediction raised exceptions, because of a missing transponed matrix .T.
Bug Fixes
- Raise
ValueErrorif diagnose time parameters are invalid (Fixes #53) - Use names of LNLs in unilateral
comp_encoding()(Fixes #56) - Wrong shape in unilateral posterior computation (missing
.T) (Fixes #57) - Wrong shape in bilateral joint posterior computation (missing
.T) (Fixes #57)
Documentation
- Add info on diagnose time distribution's
ValueError
Testing
ValueErrorraised in diagnose time distribution'sset_params- Check
comp_encoding_diagnoses()for shape and dtype - Test unilateral posterior state distribution for shape and sum
- Test bilateral posterior joint state distribution for shape and sum
- Python
Published by rmnldwg over 2 years ago
lymph-model -
What's New
Third alpha release. I am pretty confident that the lymph.models.Unilateral class works as intended since it does yield the same results as the 0.4.3 version.
The lymph.models.Bilateral class is presumably finished now as well, although there may still be issues with that. It does however compute a likelihood if asked to do so, and the results don't look implausible. So, it might be worth giving it a spin.
Also, I am now quite satisfied with the look and usability of the new API. Hopefully, this means only minor changes from here on.
Full changelog: 1.0.0.a1...1.0.0.a2
Bug Fixes
- (bi) Sync callback was wrong way around
- Assigning new
modalitiesnow preserves thetrigger_callbacks - Set
diag_time_distsparams won't fail anymore - (bi) Don't change dict size during
modalitiessync - (bi) Delegted generator attribute now resets
- (bi) Make
modalities/diag_time_distssyncable - (uni) Evolution is now running through all time-steps
Documentation
- Switch to MyST style sphinx theme
- 🛠️ Start with bilateral quickstart guide
- (uni) Reproduce llh with old and new model
Features
- Re-implement bilateral model class
- (bi) Continue rewriting bilateral class
- (helper) Add
DelegatorMixinto helpers - (uni) Use delegator to pull graph attrs up
- (bi) Add delegation of uni attrs to bilateral
- (bi) Reimplement joint state/obs dists & llh
- (uni) Allow global setting of micro & growth
- (uni) Reimplement Bayesian network model
- (log) Add logging to sync callback creation
- Get params also as iterator
- (uni) Get only edge/dist params
Refactor
state_listis now a member of thegraph.Representation& computation of involvement pattern encoding is separate function now- subclasses of
cached_propertyare used for e.g. transition and observation matrix instead of convoluted descriptors
Testing
- (uni) Add tests w.r.t. delegator mixin
- (bi) Check the delegation of ipsi attrs
- (bi) Check sync for bilateral model
- Refactor out fixtures from test suite
- Make sure bilateral llh is deterministic
- Catch warnings for cleaner output
- (uni) Add likelihood value tests
Change
assign_params& joint posterior- ⚠ BREAKING (graph) Remove
edge_paramslookup in favour of anedgedictionary in thegraph.Representation - ⚠ BREAKING The edge's and dist's
get_params()andset_params()methods now have the same function signature, making a combined loop over both possible - (bi) Rewrite the bilateral risk method
- ⚠ BREAKING Allow setting params as positional & keyword arguments in both the likelihood and the risk method
Ci
- Bump codecov action to v3
Merge
- Branch 'main' into 'dev'
- Branch 'dev' into 'reimplement-bilateral'
- Branch 'delegation-pattern' into 'dev'
- Branch 'dev' into 'reimplement-bilateral'
- Branch 'remove-descriptors' into 'reimplement-bilateral'
- Branch 'reimplement-bilateral' into 'dev'
- Python
Published by rmnldwg over 2 years ago
lymph-model -
Second alpha release to allow early testing of the new API.
What's New
Bug Fixes
- (matrix) Wrong shape of observation matrix for trinary model
Documentation
- Fix wrong python version in rtd config file
- Remove outdated sampling tutorial
- Remove deprecated read-the-docs config
- Tell read-the-docs to install extra requirements
- Execute quickstart notebook
Testing
- Check correct shapes for trinary model matrices
Full changelog: 1.0.0.a0...1.0.0.a1
- Python
Published by rmnldwg almost 3 years ago
lymph-model -
This alpha release is a reimplementation most of the package's API. It aims to solve some issues that accumulated for a while.
Features
- parameters can now be assigned centrally via a
assign_params()method, either using args or keyword arguments. This resolves #46 - expensive operations generally look expensive now, and do not just appear as if they were attribute assignments. Fixes #40
- computations around the the likelihood and risk predictions are now more modular. I.e., several conditional and joint probability vectors/matrices can now be computed conveniently and are not burried in large methods. Resolves isse #41
- support for the trinary model was added. This means lymph node levels (LNLs) can be in one of three states (healthy, microscopic involvement, macroscopic metatsasis), instead of only two (healthy, involved). Resolves #45
Documentation
- module, class, method, and attribute docstrings should now be more detailed and helpful. We switched from strictly adhering to Numpy-style docstrings to something more akin to Python's core library docstrings. I.e., parameters and behaviour are explained in natural language.
- quickstart guide has been adapted to the new API
Code Refactoring
- all matrices related to the underlying hidden Markov model (HMM) have been decoupled from the
Unilateralmodel class - the representation of the directed acyclic graph (DAG) that determined the directions of spread from tumor to and among the LNLs has been implemented in a separate class of which an instance provides access to it as an attribute of
Unilateral - access to all parameters of the graph (i.e., the edges) is bundled in a descriptor holding a
UserDict
BREAKING CHANGES
Almost the entire API has changed. I'd therefore recommend to have a look at the quickstart guide to see how the new model is used. Although most of the core concepts are still the same.
- Python
Published by rmnldwg almost 3 years ago
lymph-model -
Minimal bug fix to get a script running again.
What's new
Bug Fixes
- incomplete involvement for unilateral risk method does not raise KeyError anymore. Fixes issue #38
- Python
Published by rmnldwg over 3 years ago
lymph-model -
Minor bump that was mostly about getting the documentation's build to pass again and add a changelog to the project. The actual library's API has been left untouched.
What's new
Documentation
- fix the issue of docs failing to build
- remove outdated line in install instructions
- move conf.py back into source dir
- bundle sphinx requirements
- update the quickstart & sampling notebooks
- more stable sphinx-build & update old index
Maintenance
- fine-tune git-chglog settings to my needs
- start with a CHANGELOG
- add description to types of allowed commits
- Python
Published by rmnldwg almost 4 years ago
lymph-model -
Fixes:
- fix a typo in the
pyproject.tomlthat caused the README to disappear from PyPI
- Python
Published by rmnldwg almost 4 years ago
lymph-model -
What's new:
- a dict-like class has been added that elegantly takes care of defining and updating the distributions that are used to marginalize over the diagnose times
- the API for the likelihood got an overhaul, using the mentioned new class. It should be much more readable and easier to use, since one does not have to worry about providing time distributions as arguments anymore
- the API for the risk was changed similarly. Therefore, the most important user-facing methods have gotten a facelift
Unfortunately, I currently do not have the time to update the entire test suite. I managed to write a somewhat realistic integration test, but dropped some unit tests. I will at some point catch up on this.
- Python
Published by rmnldwg almost 4 years ago
lymph-model -
First release 🥳
This marks the first release, which will also be pushed to PyPI.
What's new
- faster tests
- fix graph-order issue #31
- Python
Published by rmnldwg almost 4 years ago