Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Add PCADecoderMetrics2 #242

wants to merge 9 commits into from

Conversation

LeonStadelmann
Copy link
Collaborator

Adressing #220.

@LeonStadelmann LeonStadelmann requested a review from MUCDK May 21, 2025 14:08
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()
Copy link
Collaborator Author

@LeonStadelmann LeonStadelmann May 21, 2025

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

Copy link
Collaborator

@MUCDK MUCDK May 22, 2025

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:

  1. provide the option to extract any adata.X or any adata.layers[key], similar how we e.g. do it in moscot
  2. bear in mind that adata.X can be both sparse and dense

@LeonStadelmann
Copy link
Collaborator Author

@MUCDK Your suggestions have been implemented, pinged since i cant request a review right now.

@@ -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] = {}
Copy link
Collaborator

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?

self.layers = layers
self.log_prefix = log_prefix

def add_validation_adata(
Copy link
Collaborator

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?

Comment on lines 109 to 111
for callback in callbacks:
if isinstance(callback, PCADecodedMetrics2):
callback.add_validation_adata(self.validation_adata)
Copy link
Collaborator

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?

Copy link
Collaborator

@MUCDK MUCDK left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants