7.12 kmeans visualise two variables
20220226
Where two variables are input to the clustering, the visualisation will be more natural for us in two dimensions.
To illustrate, use a pipeline with mlr to extract the two columns from the original training dataset. The training dataset is saved using tee so that it can be used later if need be (as it is here). The data is then piped through train , predict, and visualise.
cat iris.csv |
mlr --csv cut -f sepal_length,sepal_width |
tee iris_2.csv |
ml train kmeans 3 |
ml predict kmeans iris_2.csv |
ml visualise kmeans -o kmeans_iris_pr_vis_2.png
The resulting plot, indicating the three clusters identified, will be displayed:
In this particular example, observe how the clustering is still
apparently based on sepal_length
.
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0