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
Use _make_obs_column_categorical
for CategoricalJointObsmField
#1417
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1417 +/- ##
==========================================
+ Coverage 91.04% 91.07% +0.02%
==========================================
Files 111 111
Lines 8635 8630 -5
==========================================
- Hits 7862 7860 -2
+ Misses 773 770 -3
Continue to review full report at Codecov.
|
scvi/data/_utils.py
Outdated
|
||
# make sure each category contains enough cells | ||
unique, counts = np.unique(adata.obs[alternate_column_key], return_counts=True) | ||
unique, counts = np.unique(getattr(df, alternate_column_key), return_counts=True) | ||
if np.min(counts) < 3: | ||
category = unique[np.argmin(counts)] | ||
warnings.warn( | ||
"Category {} in adata.obs['{}'] has fewer than 3 cells. SCVI may not train properly.".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change this message to say "models" instead of SCVI
scvi/data/_utils.py
Outdated
|
||
# make sure each category contains enough cells | ||
unique, counts = np.unique(adata.obs[alternate_column_key], return_counts=True) | ||
unique, counts = np.unique(getattr(df, alternate_column_key), return_counts=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why getattr and not df[alternate_column_key]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also wait isn't this call to np unique inefficient? We already called np unique on the codes earlier on 144?
…egoricalJointObsmField`
…lJointObsmField` (#1419) Co-authored-by: Justin Hong <jjhong922@berkeley.edu>
…cverse#1417) * refactor make obs column cat * address comments * release note
Fixes #1410