|
4 | 4 | ===================================== |
5 | 5 |
|
6 | 6 | This example presents how to chain KNeighborsTransformer and TSNE in a |
7 | | -pipeline, and how to wrap the packages `annoy` and `nmslib` to replace |
8 | | -KNeighborsTransformer and perform approximate nearest neighbors. |
9 | | -These package can be installed with `pip install annoy nmslib`. |
| 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`. |
10 | 10 |
|
11 | | -Note: Currently TSNE(metric='precomputed') does not modify the precomputed |
| 11 | +Note: Currently `TSNE(metric='precomputed')` does not modify the precomputed |
12 | 12 | distances, and thus assumes that precomputed euclidean distances are squared. |
13 | 13 | In future versions, a parameter in TSNE will control the optional squaring of |
14 | 14 | precomputed distances (see #12401). |
15 | 15 |
|
16 | | -Note: In :class:`KNeighborsTransformer` we use the definition which includes |
17 | | -each training point as its own neighbor in the count of `n_neighbors`, and for |
| 16 | +Note: In KNeighborsTransformer we use the definition which includes each |
| 17 | +training point as its own neighbor in the count of `n_neighbors`, and for |
18 | 18 | compatibility reasons, one extra neighbor is computed when |
19 | 19 | `mode == 'distance'`. Please note that we do the same in the proposed wrappers. |
20 | 20 |
|
21 | 21 | Sample output: |
22 | 22 |
|
| 23 | +``` |
23 | 24 | Benchmarking on MNIST_2000: |
24 | 25 | --------------------------- |
25 | 26 | AnnoyTransformer: 0.583 sec |
|
39 | 40 | TSNE with NMSlibTransformer: 43.295 sec |
40 | 41 | TSNE with KNeighborsTransformer: 64.845 sec |
41 | 42 | TSNE with internal NearestNeighbors: 64.984 sec |
| 43 | +``` |
42 | 44 | """ |
43 | 45 | # Author: Tom Dupre la Tour |
44 | 46 | # |
|
0 commit comments