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

Bug fix in pyromixin for posterior sampling #1158

Merged
merged 9 commits into from
Oct 1, 2021
Merged

Conversation

vitkl
Copy link
Contributor

@vitkl vitkl commented Sep 14, 2021

The method ._get_obs_plate_sites() should discard observed variables (unless requested otherwise) and plates. Current code always performs posterior sampling even if unobserved local variables do not exist in the model, e.i. code never enters this statement:

if len(obs_plate_sites) == 0:
    # if no local variables - don't sample
    break

This PR addresses the issue by adding a check for observed and plates.

@codecov
Copy link

codecov bot commented Sep 14, 2021

Codecov Report

Merging #1158 (fd77e91) into master (3ce5514) will increase coverage by 0.46%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1158      +/-   ##
==========================================
+ Coverage   90.27%   90.74%   +0.46%     
==========================================
  Files          93       95       +2     
  Lines        7341     7668     +327     
==========================================
+ Hits         6627     6958     +331     
+ Misses        714      710       -4     
Impacted Files Coverage Δ
scvi/model/base/_pyromixin.py 93.85% <100.00%> (+0.93%) ⬆️
scvi/data/_built_in_data/_cite_seq.py 98.95% <0.00%> (-1.05%) ⬇️
scvi/data/_anndata.py 95.78% <0.00%> (-0.18%) ⬇️
scvi/_settings.py 87.77% <0.00%> (-0.14%) ⬇️
scvi/dataloaders/_anntorchdataset.py 93.44% <0.00%> (-0.11%) ⬇️
scvi/model/base/_base_model.py 92.47% <0.00%> (-0.10%) ⬇️
scvi/_docs.py 100.00% <0.00%> (ø)
scvi/model/_scvi.py 100.00% <0.00%> (ø)
scvi/data/__init__.py 100.00% <0.00%> (ø)
scvi/model/__init__.py 100.00% <0.00%> (ø)
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3ce5514...fd77e91. Read the comment docs.

@vitkl
Copy link
Contributor Author

vitkl commented Sep 14, 2021

@adamgayoso please have a look at this

Copy link
Member

@adamgayoso adamgayoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM outside of the small request for docstring

@@ -262,7 +262,7 @@ def _get_obs_plate_return_sites(self, return_sites, obs_plate_sites):
else:
return obs_plate_sites

def _get_obs_plate_sites(self, args, kwargs):
def _get_obs_plate_sites(self, args, kwargs, sample_observed):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you document this function and add relevant typing?

@vitkl
Copy link
Contributor Author

vitkl commented Sep 21, 2021

I think this is done now.

scvi/model/base/_pyromixin.py Outdated Show resolved Hide resolved
@vitkl
Copy link
Contributor Author

vitkl commented Sep 22, 2021 via email

@adamgayoso adamgayoso merged commit 419ba89 into scverse:master Oct 1, 2021
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