-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add usage of EMParams
#1050
Add usage of EMParams
#1050
Conversation
@WeilerP Currently, I have the following questions about the future design of the API:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @johschnee. I added two comments which should also answer two of your questions. Regarding the third: Since we'll not be writing to AnnData in the fit
method, the copy
argument will become redundant. So it doesn't really matter what the default argument is, ATM (although it's a good point).
@johschnee, is there an update on this PR? |
Yes, I was working on it actually today. I added the implementation of the abstract methods to this PR, because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johschnee, I left another few comments. Mainly two things:
- I updated/refactored the
_initialize_state_dict
function. Can you please double check that it is still working? - Can you please und all changes irrelevant to this PR (i.e., refactoring the code to rely on
EMParams
)? These changes (e.g., function implementations) should be there own PR accompanied by an issue.
FYI, @johschnee, the ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part. error is caused by a new Numpy version (see #1058). |
Class `EMParams` is now used by the `ExpectationMaximizationModel`.
Since _read_pars() should be deleted in the future, _initialize_state_dict() does not rely on it anymore.
Add implementation of state_dict() and export_results_adata() and remove use of _write_pars() in ExpectationMaximizationModel.fit().
* 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.
* 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`
76e15a1
to
15808e0
Compare
Hi @WeilerP,
Overall,
and
should lead to the same results. I tested it with simulated data and the pancreas dataset. |
After the change, parameters are not written if they contain only nan values.
Hi @WeilerP, |
Add argument `show_progress_bar` to `fit` method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @johschnee!
Changes
EMParams
is now used by theExpectationMaximizationModel
intools/_em_model.py
.Related issues
Closes #1026, #1025.