Skip to content

get_marginal_ll not implemented for perturbation example model #93

@ajaynadig

Description

@ajaynadig

Hello,
Thank you for your great work on this package. I am interested in computing the log-likelihood for unseen observation given a trained scGen model. However, I found that using get_marginal_ll throws an error "marginal_ll is not implemented for current model. Please raise an issue on github if you need it.", and appears to do so as well for the perturbation tutorial:

import logging
import scanpy as sc
import scgen

train = sc.read("train.h5ad") #Kang interferon dataset
train_new = train[~((train.obs["cell_type"] == "CD4T") &
                    (train.obs["condition"] == "stimulated"))].copy()

scgen.SCGEN.setup_anndata(train_new, batch_key="condition", labels_key="cell_type")

model = scgen.SCGEN(train_new)

model.train(
    max_epochs=100,
    batch_size=32,
    early_stopping=True,
    early_stopping_patience=25
)

likelihoods = model.get_marginal_ll(return_mean = False)

Which gives this error:
NotImplementedError: marginal_ll is not implemented for current model. Please raise an issue on github if you need it.

I realize this may be an issue with scvi-tools rather than scGen, but in any case, it would be very helpful to have easy access to log-likelihoods for scGen models, both to interpret models and for methods development on top of scGen.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions