Skip to content

Commit

Permalink
Add usage of EMParams (#1050)
Browse files Browse the repository at this point in the history
* Add usage of `EMParams`

Class `EMParams` is now used by the `ExpectationMaximizationModel`.

* Remove use of `_read_pars()` from `_em_model.py`

Since _read_pars() should be deleted in the future,
_initialize_state_dict() does not rely on it anymore.

* Implement abstact methods

Add implementation of state_dict() and export_results_adata() and
remove use of _write_pars() in ExpectationMaximizationModel.fit().

* Add type hints to `_initialize_state_dict`

* Refactor `_initialize_state_dict`

* Rename variables (`pars_names` to `parameters`, `pars` to
`parameter_dict`).
* Restructure code to reduce number of variables.
* Update definition of parameters initialized with as nan.

* Refine `ExpectationMaximizationModel`

* Add metadata the attributes to `EMParams`
* Add methods read/write `EMParams` from/to AnnData
* Adapt the method `fit()` such that it uses the class `EMParams`
* Include `_align_dynamics()` as a method in
  `ExpectationMaximizationModel` and adapt it to also use `EMParams`
* Include `_flatten()` from `_em_model_core.py`

* Modify export to AnnData

After the change, parameters are not written if they contain only
nan values.

* Update `_em_model.py`

Add argument `show_progress_bar` to `fit` method.

* Update `tests/test_basic.py`

---------

Co-authored-by: Philipp Weiler <[email protected]>
  • Loading branch information
johschnee and WeilerP authored Dec 1, 2023
1 parent 3fe3d70 commit 43faf36
Show file tree
Hide file tree
Showing 2 changed files with 224 additions and 102 deletions.
Loading

0 comments on commit 43faf36

Please sign in to comment.