-
Notifications
You must be signed in to change notification settings - Fork 10
Add PCADecoderMetrics2 #242
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
base: main
Are you sure you want to change the base?
Conversation
src/cellflow/training/_callbacks.py
Outdated
for cond in conditions_adata & conditions_pred: | ||
true_counts[name][cond] = self.validation_adata[name][ | ||
self.validation_adata[name].obs[self.condition_id_key] == cond | ||
].X.toarray() |
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.
Could we potentially go OOM here when using real data? I was not sure @MUCDK
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.
should be fine, because we first subset the adata before densifying.
two things here:
- provide the option to extract any adata.X or any adata.layers[key], similar how we e.g. do it in moscot
- bear in mind that adata.X can be both sparse and dense
@MUCDK Your suggestions have been implemented, pinged since i cant request a review right now. |
src/cellflow/model/_cellflow.py
Outdated
@@ -56,6 +56,7 @@ def __init__(self, adata: ad.AnnData, solver: Literal["otfm", "genot"] = "otfm") | |||
self._dataloader: TrainSampler | None = None | |||
self._trainer: CellFlowTrainer | None = None | |||
self._validation_data: dict[str, ValidationData] = {} | |||
self._validation_adata: dict[str, ad.Anndata] = {} |
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.
can we make these attributes of the callbacks directly?
src/cellflow/training/_callbacks.py
Outdated
self.layers = layers | ||
self.log_prefix = log_prefix | ||
|
||
def add_validation_adata( |
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.
this can be part of __init__
, can't it?
src/cellflow/training/_trainer.py
Outdated
for callback in callbacks: | ||
if isinstance(callback, PCADecodedMetrics2): | ||
callback.add_validation_adata(self.validation_adata) |
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.
I don't think this would be needed if validation_adata
was an attribute of the callback, would it?
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.
Let's try to make the validation_adata
an attribute of the callback, as outlined in the comments.
Adressing #220.