# kmeans
model <- kmeans(iris[1:4], 3)
cluster_performance(model)
# hclust
data <- iris[1:4]
model <- hclust(dist(data))
clusters <- cutree(model, 3)
rez <- cluster_performance(model, data, clusters)
rez
if (FALSE) { # require("dbscan", quietly = TRUE)
# DBSCAN
model <- dbscan::dbscan(iris[1:4], eps = 1.45, minPts = 10)
rez <- cluster_performance(model, iris[1:4])
rez
}
# Retrieve performance from parameters
params <- model_parameters(kmeans(iris[1:4], 3))
cluster_performance(params)
Run the code above in your browser using DataLab