Skip to content
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

Error computing posterior predictive check calibration_error #2820

Closed
jpintar opened this issue Jun 3, 2024 · 1 comment
Closed

Error computing posterior predictive check calibration_error #2820

jpintar opened this issue Jun 3, 2024 · 1 comment
Labels

Comments

@jpintar
Copy link

jpintar commented Jun 3, 2024

Using scvi.criticism, I can successfully perform all available posterior predictive checks on my scANVI model (coefficient_of_variation, zero_fraction, differential_expression) except for calibration_error.

When I try

from scvi.criticism import PosteriorPredictiveCheck
ppc = PosteriorPredictiveCheck(
    adata,
    models_dict={'scANVI': scanvi_model},
    count_layer_key='raw',
    n_samples=10,
)
ppc.calibration_error()

I get the following error:

AttributeError                            Traceback (most recent call last)
Cell In[90], line 1
----> 1 ppc.calibration_error()

File [/<envpath>/lib/python3.10/site-packages/scvi/criticism/_ppc.py:240](http://localhost:9998/<envpath>/python3.10/site-packages/scvi/criticism/_ppc.py#line=239), in PosteriorPredictiveCheck.calibration_error(self, confidence_intervals)
    238 end = interval[1]
    239 true_width = ps[end] - ps[start]
--> 240 greater_than = (quants[DATA_VAR_RAW] >= quants.model1.isel(quantile=start)).data
    241 less_than = (quants[DATA_VAR_RAW] <= quants.model1.isel(quantile=end)).data
    242 # Logical and

File [/<envpath>/lib/python3.10/site-packages/xarray/core/common.py:286](http://localhost:9998/<envpath>/lib/python3.10/site-packages/xarray/core/common.py#line=285), in AttrAccessMixin.__getattr__(self, name)
    284         with suppress(KeyError):
    285             return source[name]
--> 286 raise AttributeError(
    287     f"{type(self).__name__!r} object has no attribute {name!r}"
    288 )

AttributeError: 'Dataset' object has no attribute 'model1'

Versions:

scvi-tools 1.1.1
xarray 2024.2.0

@jpintar jpintar added the bug label Jun 3, 2024
@canergen
Copy link
Contributor

This function is currently not implemented. It exists in the code base but was never used. We are currently reworking the criticism module and will likely remove this metric in the future package.

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

No branches or pull requests

2 participants