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

Density subsampling #106

Open
scottgigante opened this issue Jun 8, 2020 · 1 comment
Open

Density subsampling #106

scottgigante opened this issue Jun 8, 2020 · 1 comment

Comments

@scottgigante
Copy link
Contributor

Describe the solution you'd like
scprep.select.subsample(density=True, knn=3). Use nmslib if available?

Describe alternatives you've considered
Use sklearn.NearestNeighbors

@scottgigante
Copy link
Contributor Author

distances, _ = sklearn.NearestNeighbors(n_neighbors=3).fit(X).kneighbors()
distances = distances.max(axis=1)
p = distances / distances.sum()
X_subsample = scprep.select.select_rows(X, idx=np.random.choice(X.shape[0], n, p=p, replace=False)

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

No branches or pull requests

1 participant