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

Merged
merged 41 commits into from
Dec 19, 2024

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 requested a review from ivirshup April 20, 2020 20:47
@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.42857% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.12%. Comparing base (7e3dd15) to head (ce02426).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/scanpy/_compat.py 91.66% 2 Missing ⚠️
src/scanpy/preprocessing/_simple.py 98.03% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #943      +/-   ##
==========================================
- Coverage   76.53%   74.12%   -2.42%     
==========================================
  Files         111      112       +1     
  Lines       12881    12937      +56     
==========================================
- Hits         9859     9589     -270     
- Misses       3022     3348     +326     
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 88.48% <98.03%> (-1.47%) ⬇️
src/scanpy/_compat.py 70.00% <91.66%> (-9.44%) ⬇️

... and 21 files with indirect coverage changes

@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
@flying-sheep flying-sheep requested a review from Intron7 December 12, 2024 14:22
@flying-sheep flying-sheep linked an issue Dec 13, 2024 that may be closed by this pull request
src/scanpy/preprocessing/_simple.py Outdated Show resolved Hide resolved
src/scanpy/preprocessing/_simple.py Show resolved Hide resolved
@flying-sheep flying-sheep requested a review from Intron7 December 19, 2024 09:36
@flying-sheep flying-sheep enabled auto-merge (squash) December 19, 2024 09:47
@flying-sheep flying-sheep merged commit 86d656d into main Dec 19, 2024
6 of 12 checks passed
@flying-sheep flying-sheep deleted the withreplacement branch December 19, 2024 16:48
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.

sc.pp.subsample, allow for sampling with replacement
6 participants