Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
python3 -m pip install .[test]
- name: Run tests
run: |
coverage run --omit=tests/*,*/_*.py -m pytest
coverage run --omit=tests/*,*/_*.py -m pytest --doctest-modules
coverage xml
- name: Upload to codecov
uses: codecov/codecov-action@v3
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

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

## [1.3.1] - 2025-01-31

### 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] - 2025-01-29

### Bug Fixes
Expand Down Expand Up @@ -819,10 +837,11 @@ Almost the entire API has changed. I'd therefore recommend to have a look at the
- fix pyproject.toml typo
- add pre-commit hook to check commit msg

[1.3.1]: https://github.com/rmnldwg/lymph/compare/1.3.0...1.3.1
[1.3.0]: https://github.com/rmnldwg/lymph/compare/1.2.3...1.3.0
[1.2.3]: https://github.com/rmnldwg/lymph/compare/1.2.2...1.2.3
[1.2.2]: https://github.com/rmnldwg/lymph/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/rmnldwg/lymph/compare/1.1.0...1.2.1
[1.2.1]: https://github.com/rmnldwg/lymph/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/rmnldwg/lymph/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/rmnldwg/lymph/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/rmnldwg/lymph/compare/1.0.0.rc2...1.0.0
Expand Down
101 changes: 0 additions & 101 deletions lymph/mixins.py

This file was deleted.

3 changes: 1 addition & 2 deletions lymph/models/bilateral.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import pandas as pd

from lymph import diagnosis_times, matrix, mixins, modalities, models, types, utils
from lymph import diagnosis_times, matrix, modalities, models, types, utils

warnings.filterwarnings("ignore", category=pd.errors.PerformanceWarning)
logger = logging.getLogger(__name__)
Expand All @@ -19,7 +19,6 @@
class Bilateral(
diagnosis_times.Composite,
modalities.Composite,
mixins.NamedParamsMixin,
types.Model,
):
"""Class that models metastatic progression in a bilateral lymphatic system.
Expand Down
3 changes: 1 addition & 2 deletions lymph/models/hpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import numpy as np
import pandas as pd

from lymph import diagnosis_times, mixins, modalities, models, types, utils
from lymph import diagnosis_times, modalities, models, types, utils

warnings.filterwarnings("ignore", category=pd.errors.PerformanceWarning)
logger = logging.getLogger(__name__)
Expand All @@ -34,7 +34,6 @@ def wrapper(self, *args, hpv_status: bool | None = None, **kwargs):
class HPVUnilateral(
diagnosis_times.Composite,
modalities.Composite,
mixins.NamedParamsMixin,
types.Model,
):
"""Class that models metastatic progression in HPV and non HPV lymphatic systems.
Expand Down
3 changes: 1 addition & 2 deletions lymph/models/midline.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import pandas as pd

from lymph import diagnosis_times, matrix, mixins, modalities, models, types, utils
from lymph import diagnosis_times, matrix, modalities, models, types, utils

warnings.filterwarnings("ignore", category=pd.errors.PerformanceWarning)
logger = logging.getLogger(__name__)
Expand All @@ -23,7 +23,6 @@
class Midline(
diagnosis_times.Composite,
modalities.Composite,
mixins.NamedParamsMixin,
types.Model,
):
r"""Models metastatic progression bilaterally with tumor lateralization.
Expand Down
11 changes: 3 additions & 8 deletions lymph/models/unilateral.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
import pandas as pd
from cachetools import LRUCache

from lymph import diagnosis_times, graph, matrix, mixins, modalities, types, utils

# pylint: disable=unused-import
from lymph.utils import ( # nopycln: import
from lymph import diagnosis_times, graph, matrix, modalities, types, utils
from lymph.utils import (
add_or_mult,
dict_to_func, # noqa: F401
draw_diagnosis, # noqa: F401
Expand All @@ -34,7 +32,6 @@
class Unilateral(
diagnosis_times.Composite,
modalities.Composite,
mixins.NamedParamsMixin,
types.Model,
):
"""Class that models metastatic progression in a unilateral lymphatic system.
Expand Down Expand Up @@ -938,10 +935,8 @@ def draw_patients(
Method to draw individual diagnosis.
:py:meth:`lymph.models.Bilateral.draw_patients`
The corresponding bilateral method.

"""
if rng is None:
rng = np.random.default_rng(seed)
rng = rng or np.random.default_rng(seed)

if sum(stage_dist) != 1.0:
warnings.warn("Sum of stage distribution is not 1. Renormalizing.")
Expand Down
Loading