This is an app done as part of the Developing Data Products online course on Coursera.
August 17, 2017
This is an app done as part of the Developing Data Products online course on Coursera.
This app provides an interface for a user to run K-means clustering on the iris dataset
A slider input is provided for the user to control the number of clusters.
By default, the K-means clustering function does not print out a user friendly output:
kmeans_mdl <- kmeans(iris[, 3:4], 3) kmeans_mdl
## K-means clustering with 3 clusters of sizes 52, 48, 50 ## ## Cluster means: ## Petal.Length Petal.Width ## 1 4.269231 1.342308 ## 2 5.595833 2.037500 ## 3 1.462000 0.246000 ## ## Clustering vector: ## [1] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ## [36] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ## [71] 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 ## [106] 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 1 2 ## [141] 2 2 2 2 2 2 2 2 2 2 ## ## Within cluster sum of squares by cluster: ## [1] 13.05769 16.29167 2.02200 ## (between_SS / total_SS = 94.3 %) ## ## Available components: ## ## [1] "cluster" "centers" "totss" "withinss" ## [5] "tot.withinss" "betweenss" "size" "iter" ## [9] "ifault"
However, with the app, it produces a nice plot which allows the user to visualise the results of the clustering: