Skip to content

Commit 53e47df

Browse files
authored
Merge pull request #3981 from PrimozGodec/neighbor-documentation
Neighbors documentation update
2 parents 008680f + debf8e3 commit 53e47df

File tree

8 files changed

+13
-8
lines changed

8 files changed

+13
-8
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
62.5 KB
Loading
61.4 KB
Loading
219 KB
Loading
23.8 KB
Loading

doc/visual-programming/source/widgets/data/neighbors.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,22 @@ Compute nearest neighbors in data according to reference.
66
**Inputs**
77

88
- Data: An input data set.
9-
- Reference: A reference data instance for neighbor computation.
9+
- Reference: A reference data for neighbor computation.
1010

1111
**Outputs**
1212

1313
- Neighbors: A data table of nearest neighbors according to reference.
1414

15-
The **Neighbors** widget computes nearest neighbors for a given reference and for a given distance measure.
15+
The **Neighbors** widget computes nearest neighbors for a given reference and for a given distance measure. The reference can be either one instance or more instances. In the case with one reference widget outputs closest `n` instances from data where `n` is set by the **Number of neighbors** option in the widget. When reference contains more instances widget computes the combined distance for each data instance as a minimum of distances to each reference. Widget outputs `n` data instances with lowest combined distance.
1616

17-
![](images/Neighbors-stamped.png)
17+
![](images/neighbours-stamped.png)
1818

1919
1. Information on the input data.
20-
2. Distance measure for computing neighbors. Supported measures are: Euclidean, Manhattan, Mahalanobis, Cosine, Jaccard, Spearman, absolute Spearman, Pearson, absolute Pearson. If *Exclude references* is ticked, data instances that are highly similar to the reference (distance < 1e-5), will be excluded.
20+
2. Distance measure for computing neighbors. Supported measures are: Euclidean, Manhattan, Mahalanobis, Cosine, Jaccard, Spearman, absolute Spearman, Pearson, absolute Pearson.
2121
3. Number of neighbors on the output.
22-
4. Click *Apply* to commit the changes. To communicate changes automatically tick *Apply Automatically*.
23-
5. Access widget help.
22+
4. If *Exclude rows (equal to) references* is ticked, data instances that are highly similar to the reference (distance < 1e-5), will be excluded.
23+
5. Click *Apply* to commit the changes. To communicate changes automatically tick *Apply Automatically*.
24+
6. Access widget help.
2425

2526
Examples
2627
--------
@@ -29,10 +30,14 @@ In the first example, we used *iris* data and passed it to **Neighbors** and to
2930

3031
We can observe the results of neighbor computation in **Data Table (1)**, where we can see 10 closest images to our selected iris flower.
3132

32-
![](images/Neighbors-Example1.png)
33+
![](images/neighbours-example1.png)
34+
35+
Now change the selection **Data Table** to multiple examples. As a result, we get instances with closest combined distances to the references. The method computes the combined distance as a minimum of distances to each reference.
36+
37+
![](images/neighbours-example-multiple.png)
3338

3439
Another example requires the installation of Image Analytics add-on. We loaded 15 paintings from famous painters with **Import Images** widget and passed them to **Image Embedding**, where we selected *Painters* embedder.
3540

3641
Then the procedure is the same as above. We passed embedded images to **Image Viewer** and selected a painting from Monet to serve as our reference image. We passed the image to **Neighbors**, where we set the distance measure to *cosine*, ticked off *Exclude reference* and set the neighbors to 2. This allows us to find the actual closest neighbor to a reference painting and observe them side by side in **Image Viewer (1)**.
3742

38-
![](images/Neighbors-Example2.png)
43+
![](images/neighbours-example2.png)

0 commit comments

Comments
 (0)