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

Add replace option to subsample and rename function to sample #943

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

gokceneraslan
Copy link
Collaborator

@gokceneraslan gokceneraslan commented Dec 2, 2019

so that we can do sampling with replacement. It can be useful for bootstrap samples i.e. sc.pp.subsample(adata, n_obs=adata.n_obs, replace=True). We can also sample fractions > 1, but then it's not really subsampling.

@gokceneraslan
Copy link
Collaborator Author

Maybe we should make a new function called sc.pp.sample?

@ivirshup
Copy link
Member

I'd like to merge this.

I think we could just rename the function, and deprecate subsample. I'd like the name sample more for this function if we could add a dim argument so users can subsample on the variable as well.

@gokceneraslan gokceneraslan changed the title Add replace option to subsample. Add replace option to subsample and rename function to sample Apr 20, 2020
Copy link
Member

@ivirshup ivirshup left a comment

Choose a reason for hiding this comment

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

Looks good! Just a few minor comments.

scanpy/preprocessing/_simple.py Outdated Show resolved Hide resolved
scanpy/tests/test_preprocessing.py Outdated Show resolved Hide resolved
scanpy/tests/test_preprocessing.py Outdated Show resolved Hide resolved
scanpy/preprocessing/_simple.py Outdated Show resolved Hide resolved
@flying-sheep flying-sheep self-assigned this Nov 14, 2024
@flying-sheep flying-sheep added this to the 1.11.0 milestone Nov 14, 2024
Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 96.20253% with 3 lines in your changes missing coverage. Please review.

Project coverage is 76.37%. Comparing base (7131500) to head (396b21a).

Files with missing lines Patch % Lines
src/scanpy/_compat.py 91.66% 2 Missing ⚠️
src/scanpy/preprocessing/_simple.py 97.82% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #943      +/-   ##
==========================================
- Coverage   76.50%   76.37%   -0.13%     
==========================================
  Files         111      112       +1     
  Lines       12874    12927      +53     
==========================================
+ Hits         9849     9873      +24     
- Misses       3025     3054      +29     
Files with missing lines Coverage Δ
src/scanpy/preprocessing/__init__.py 100.00% <100.00%> (ø)
src/scanpy/preprocessing/_deprecated/sampling.py 100.00% <100.00%> (ø)
src/scanpy/preprocessing/_simple.py 91.29% <97.82%> (+1.34%) ⬆️
src/scanpy/_compat.py 72.95% <91.66%> (-8.87%) ⬇️

... and 9 files with indirect coverage changes

---- 🚨 Try these New Features:

@flying-sheep flying-sheep changed the base branch from main to pa/deprecated November 21, 2024 13:47
Base automatically changed from pa/deprecated to main November 22, 2024 14:11
An error occurred while trying to automatically change base from pa/deprecated to main November 22, 2024 14:11
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.

5 participants