-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ajdapretnar/documentation
Updated documentation for k-Means and PolyReg
- Loading branch information
Showing
35 changed files
with
104 additions
and
75 deletions.
There are no files selected for viewing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
0 139 38 | ||
1 154 86 | ||
2 154 182 | ||
3 154 592 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
0 182 34 | ||
1 182 87 | ||
2 182 482 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Diff not rendered.
Diff not rendered.
Oops, something went wrong.
Oops, something went wrong.
Diff not rendered.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,104 @@ | ||
Interactive k-means | ||
=================== | ||
|
||
.. figure:: icons/mywidget.png | ||
.. figure:: icons/interactive-kmeans.png | ||
|
||
Educational widgets that shows working of a k-means clustering. | ||
Educational widget that shows the working of a k-means clustering. | ||
|
||
Signals | ||
------- | ||
Inputs | ||
~~~~~~ | ||
- **Data** | ||
|
||
**Inputs**: | ||
|
||
- **Data** | ||
|
||
Input data set. | ||
|
||
Outputs | ||
~~~~~~~ | ||
**Outputs**: | ||
|
||
- **Data** | ||
|
||
- **Data** | ||
Data set with clusters labels annotation. | ||
Data set with cluster annotation. | ||
|
||
- **Centroids** | ||
Centroids position | ||
- **Centroids** | ||
|
||
Centroids position. | ||
|
||
Description | ||
----------- | ||
|
||
The aim of this widget is to show the working of a k-means clustering algorithm on two attributes from data set. | ||
Widget applies k-means clustering to the selected two attributes step by step. User can step through the algorithm and | ||
see how the algorithm works. | ||
The aim of this widget is to show the working of a `k-means clustering algorithm <https://en.wikipedia.org/wiki/K-means_clustering>`__ | ||
on two attributes from a data set. The widget applies k-means clustering to the selected two attributes step by step. Users can step | ||
through the algorithm and see how it works. | ||
|
||
.. figure:: images/interactive-kmeans-stamped.png | ||
|
||
1. Select attributes for **x** and **y** axis. | ||
|
||
.. figure:: images/kmeanswidget1.png | ||
2. *Number of centroids*: set the number of centroids. | ||
|
||
1. Select attribute for **x** axis and attribute for **y** axis. | ||
*Randomize*: randomly assigns position of centroids. If you want to add centroid on a particular position in the graph, | ||
click on this position. If you want to move the centroid, drag and drop it on the desired position. | ||
|
||
2. Select number of centroids in the spinner. If you want new random positions of the centroids or restart the algorithm | ||
in any point, you can click on **Randomize** button. If you want to add centroid on particular position in the graph | ||
just click on this position. If you want to move centroid, grab it and drop it on the desired position. | ||
*Show membership lines*: if ticked, connection between data points and closest centroids are shown. | ||
|
||
3. Step through the algorithm with **Recompute centroids** and **Reassign membership**. If you want to make step back | ||
use **Step back** button. You can also step automatically with pressing on **Run** button. **Speed** spinner can be used | ||
to set the speed of automatic stepping. | ||
3. **Recompute centroids** or **Reassign membership**: step through different stages of the algoritm. *Recompute centroids* moves centroids to new positions, based on the most central position of the data assigned to the centroid. *Reassign membership* reassigns data points to the centroid they are the closest to. | ||
|
||
**Step back**: make a step back in the algorithm. | ||
|
||
**Run**: step through the algorithm automatically. | ||
|
||
**Speed**: set the speed of automatic stepping. | ||
|
||
4. *Save Image* saves the image to the computer in a .svg or .png | ||
format. | ||
|
||
|
||
Example | ||
------- | ||
|
||
Here are two possible schemas that shows how the **Interactive k-Menas** widget can be used. You can load data form | ||
**File** or use any other data source, such as **Paint Data**. Interactive k-Menas widget also produce the data table | ||
with results of clustering and table with centroids positions. That can be inspected with **Data Table** widget or andy | ||
other widgets (e.g. Scatter Plot). | ||
Here are two possible schemas that show how the **Interactive k-Means** widget can be used. You can load the data from | ||
**File** or use any other data source, such as | ||
**Paint Data**. Interactive k-Means widget also produces a data table | ||
with results of clustering and a table with centroids positions. These data can be inspected with the | ||
**Data Table** widget. | ||
|
||
.. figure:: images/interactive-kmeans-input.png | ||
|
||
Let us demonstrate the working of the widget on *Iris* data set. | ||
|
||
.. figure:: images/orangekmeans1.png | ||
We provide the data using **File**. | ||
Then we open **Interactive k-Means**. Say, we will demonstrate k-Means on *petal length* and *petal width* attributes, | ||
so we set them as *X* and *Y* parameters. We also decided to perform clustering for 3 clusters. This is set as the | ||
*Number of centroids*. | ||
|
||
Let us demonstrate the working of the widget on *Iris Dataset*. | ||
.. figure:: images/interactive-kmeans-step1.png | ||
|
||
We provide data from data set using **File widget**. Then we open **Interactive k-Means** widget. We decided that we | ||
will demonstrate k-Menas on *petal length* and *petal width* attributes, so we set them as *X* and *Y* parameters. | ||
We also decided to perform a clustering in 3 clusters. This is set as *Number of centroids*. After that we get this | ||
figure. | ||
If we are not satisfied with positions of centroids we can change them with a click on the **Randomize** button. Then we | ||
perform the first recomputing of centroids with a click on the **Recompute centroids**. We get the following image. | ||
|
||
.. figure:: images/kmeansstep1.png | ||
.. figure:: images/interactive-kmeans-step2.png | ||
|
||
If we are not satisfied with positions of centroids we can change it with click on **Randomize** button. Then we | ||
perform first recomputing of centroids with click on **Recompute centroids** button. We get following image. | ||
The next step is to reassign membership of all points to the closest centroid. This is performed with a click on | ||
the **Reasign membership** button. | ||
|
||
.. figure:: images/kmeansstep2.png | ||
.. figure:: images/interactive-kmeans-step3.png | ||
|
||
The next step is to reassign membership of point to the closest centroid. It is performed with click on | ||
**Reasign membership** button. | ||
Then we repeat these two steps until the algorithm converges. This is the final result. | ||
|
||
.. figure:: images/kmeansstep3.png | ||
.. figure:: images/interactive-kmeans-step4.png | ||
|
||
Then we repeat that two steps until algorithm converges. It is final result. | ||
Perhaps we are not satisfied with the result because we noticed that maybe classification into 4 clusters would be better. | ||
So we decided to add a new centroid. We can do this by increasing the number of centroids in the control menu or with a click on | ||
the position in the graph where we want to place the centroid. We decided to add it with a click. The new centroid is the orange one. | ||
|
||
.. figure:: images/kmeanssteplast.png | ||
.. figure:: images/interactive-kmeans-step5.png | ||
|
||
But we are not satisfied with result because we noticed that maybe classification in 4 clusters would be better. | ||
So we decided to add a new centroid. We can make it with increasing number of centroids in left menu or with click on | ||
position in graph where we want to place the centroid. We decided to add it with click. New centroid is red one. | ||
Now we can repeat running the algorithm until it converges again, but before that we will move the new centroid to | ||
change the behavior of the algorithm. We grabbed the orange centroid and moved it to the desired position. | ||
|
||
.. figure:: images/kmeansnewcentroid.png | ||
.. figure:: images/interactive-kmeans-step6.png | ||
|
||
Now we can repeat some steps that algorithm converges again, but before we will move green centroid to change the | ||
behavior of the algorithm. We grab green centroid and moved it to desired position. | ||
Then we press *Run* and observe the centroids while the algorithm converges again. | ||
|
||
.. figure:: images/kmeansstepmovedc.png | ||
.. figure:: images/interactive-kmeans-step7.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters