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

t-SNE optimization using scikit-learn-intelex #3061

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ dependencies = [
"h5py>=3.1",
"tqdm",
"scikit-learn>=0.24",
"scikit-learn-intelex>=2024.3.0",
"statsmodels>=0.13",
"patsy",
"networkx>=2.7",
Expand Down
4 changes: 3 additions & 1 deletion scanpy/tools/_tsne.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,16 @@
)
)
if use_fast_tsne is False: # In case MultiCore failed to import
from sklearnex import patch_sklearn,unpatch_sklearn
patch_sklearn()
from sklearn.manifold import TSNE

# unfortunately, sklearn does not allow to set a minimum number
# of iterations for barnes-hut tSNE
tsne = TSNE(**params_sklearn)
logg.info(" using sklearn.manifold.TSNE")
X_tsne = tsne.fit_transform(X)

unpatch_sklearn()

Check warning on line 168 in scanpy/tools/_tsne.py

View check run for this annotation

Codecov / codecov/patch

scanpy/tools/_tsne.py#L168

Added line #L168 was not covered by tests
# update AnnData instance
adata.obsm["X_tsne"] = X_tsne # annotate samples with tSNE coordinates
adata.uns["tsne"] = {
Expand Down
Loading