Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Program 6: Use Simple Kmeans, DBScan, Hierachical clustering algorithms for clustering.

Compare the performance of clusters by changing the parameters involved in the algorithms.

pro6.R

library(dbscan)
#kmeans
cl <- kmeans(iris[,-5], 3)
Xplot(iris[,-5], col = cl$cluster)
points(cl$centers, col = 1:3, pch = 8)

#heirarchical
clusters <- hclust(dist(iris[, -5]))
plot(clusters)

#DBScan
cl <- dbscan(iris[,-5], eps = .5, minPts = 5)
plot(iris[,-5], col = cl$cluster)

OUTPUT:

You might also like