Skip to content

Commit fc06ad3

Browse files
committed
Pushing the docs to dev/ for branch: main, commit 9258e329e05b75f4b531b6d0660c0b1bd4d20a16
1 parent 4fc0d24 commit fc06ad3

File tree

1,236 files changed

+4340
-4321
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,236 files changed

+4340
-4321
lines changed
Binary file not shown.
Binary file not shown.

dev/_downloads/73ec8f08ae3ece02509539ee03cc3cdd/approximate_nearest_neighbors.ipynb

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dev/_downloads/dcd99fee3ee8ac76b69a1d2d6f5c7e78/approximate_nearest_neighbors.py

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,43 @@
33
Approximate nearest neighbors in TSNE
44
=====================================
55
6-
This example presents how to chain KNeighborsTransformer and TSNE in a
7-
pipeline. It also shows how to wrap the packages `annoy` and `nmslib` to
8-
replace KNeighborsTransformer and perform approximate nearest neighbors.
9-
These packages can be installed with `pip install annoy nmslib`.
6+
This example presents how to chain KNeighborsTransformer and TSNE in a pipeline.
7+
It also shows how to wrap the packages `annoy` and `nmslib` to replace
8+
KNeighborsTransformer and perform approximate nearest neighbors. These packages
9+
can be installed with `pip install annoy nmslib`.
1010
1111
Note: In KNeighborsTransformer we use the definition which includes each
1212
training point as its own neighbor in the count of `n_neighbors`, and for
13-
compatibility reasons, one extra neighbor is computed when
14-
`mode == 'distance'`. Please note that we do the same in the proposed wrappers.
13+
compatibility reasons, one extra neighbor is computed when `mode == 'distance'`.
14+
Please note that we do the same in the proposed wrappers.
1515
1616
Sample output::
1717
1818
Benchmarking on MNIST_2000:
1919
---------------------------
20-
AnnoyTransformer: 0.583 sec
21-
NMSlibTransformer: 0.321 sec
22-
KNeighborsTransformer: 1.225 sec
23-
TSNE with AnnoyTransformer: 4.903 sec
24-
TSNE with NMSlibTransformer: 5.009 sec
25-
TSNE with KNeighborsTransformer: 6.210 sec
26-
TSNE with internal NearestNeighbors: 6.365 sec
20+
AnnoyTransformer: 0.305 sec
21+
NMSlibTransformer: 0.144 sec
22+
KNeighborsTransformer: 0.090 sec
23+
TSNE with AnnoyTransformer: 2.818 sec
24+
TSNE with NMSlibTransformer: 2.592 sec
25+
TSNE with KNeighborsTransformer: 2.338 sec
26+
TSNE with internal NearestNeighbors: 2.364 sec
2727
2828
Benchmarking on MNIST_10000:
2929
----------------------------
30-
AnnoyTransformer: 4.457 sec
31-
NMSlibTransformer: 2.080 sec
32-
KNeighborsTransformer: 30.680 sec
33-
TSNE with AnnoyTransformer: 30.225 sec
34-
TSNE with NMSlibTransformer: 43.295 sec
35-
TSNE with KNeighborsTransformer: 64.845 sec
36-
TSNE with internal NearestNeighbors: 64.984 sec
30+
AnnoyTransformer: 2.874 sec
31+
NMSlibTransformer: 1.098 sec
32+
KNeighborsTransformer: 1.264 sec
33+
TSNE with AnnoyTransformer: 16.118 sec
34+
TSNE with NMSlibTransformer: 15.281 sec
35+
TSNE with KNeighborsTransformer: 15.400 sec
36+
TSNE with internal NearestNeighbors: 15.573 sec
37+
38+
39+
Note that the prediction speed KNeighborsTransformer was optimized in
40+
scikit-learn 1.1 and therefore approximate methods are not necessarily faster
41+
because computing the index takes time and can nullify the gains obtained at
42+
prediction time.
3743
3844
"""
3945

@@ -211,11 +217,12 @@ def run_benchmark():
211217
n_neighbors = int(3.0 * perplexity + 1) + 1
212218

213219
tsne_params = dict(
220+
init="random", # pca not supported for sparse matrices
214221
perplexity=perplexity,
215222
method="barnes_hut",
216223
random_state=42,
217224
n_iter=n_iter,
218-
square_distances=True,
225+
learning_rate="auto",
219226
)
220227

221228
transformers = [

dev/_downloads/scikit-learn-docs.zip

-5.08 KB
Binary file not shown.
-35 Bytes
-811 Bytes
243 Bytes
-16 Bytes
-2 Bytes
-47 Bytes
-58 Bytes
13 Bytes
-21 Bytes
102 Bytes
-129 Bytes
-102 Bytes
-1.68 KB
-794 Bytes
-629 Bytes
108 Bytes
-210 Bytes
137 Bytes
14 Bytes
-115 Bytes
64 Bytes
49 Bytes
-115 Bytes
44 Bytes
-77 Bytes
24 Bytes
-43 Bytes
-142 Bytes
-7 Bytes
31 Bytes
-12 Bytes

dev/_sources/auto_examples/applications/plot_cyclical_feature_engineering.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_digits_denoising.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_face_recognition.rst.txt

Lines changed: 5 additions & 5 deletions

dev/_sources/auto_examples/applications/plot_model_complexity_influence.rst.txt

Lines changed: 15 additions & 15 deletions

dev/_sources/auto_examples/applications/plot_out_of_core_classification.rst.txt

Lines changed: 29 additions & 29 deletions

dev/_sources/auto_examples/applications/plot_outlier_detection_wine.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_prediction_latency.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_species_distribution_modeling.rst.txt

Lines changed: 2 additions & 2 deletions

dev/_sources/auto_examples/applications/plot_stock_market.rst.txt

Lines changed: 1 addition & 1 deletion

dev/_sources/auto_examples/applications/plot_tomography_l1_reconstruction.rst.txt

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)