theislab / cpa

The Compositional Perturbation Autoencoder (CPA) is a deep generative framework to learn effects of perturbations at the single-cell level. CPA performs OOD predictions of unseen combinations of drugs, learns interpretable embeddings, estimates dose-response curves, and provides uncertainty estimates.
BSD 3-Clause "New" or "Revised" License
83 stars 17 forks source link

model.predict(adata) behavior, what is exactly obsm['CPA_pred'] ? #59

Open aidenOwlen opened 1 month ago

aidenOwlen commented 1 month ago

Hi,

Regarding the tutorial on OOD perturbation prediction on Kang: https://colab.research.google.com/github/theislab/cpa/blob/master/docs/tutorials/Kang.ipynb

I don't get model.predict(adata) behavior, what is exactly saved in obsm['CPA_pred'] ? because afterwards R2 is computed between obsm["CPA_pred"] and layers["counts"]: x_true = cat_adata.layers['counts'] x_pred = cat_adata.obsm['CPA_pred']

In the notebook tutorial x_true and x_pred have the same shape. Shouldn't the expected behavior be to take control cells and stimulate them ? In that case x_pred should have same number of samples as control cells for a particular cell_type, not the same number as stimulated cells. What am I missing ?

Thanks.

pgm99 commented 6 days ago

Hi, I have the same question. After some brainstorming, I understood that CPA_pred contains the predictions for all cells. Therefore, the prediction for control cells would represent "predicted stimulated cells," while the prediction for real stimulated cells would correspond to "reconstructed stimulated cells."

I'm not entirely sure if this interpretation is correct, so I would also appreciate confirmation from the authors.

Thanks.