cluster_performance: Performance of clustering models

Description Usage Arguments Examples

View source: R/cluster_performance.R

Description

Compute performance indices for clustering solutions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
cluster_performance(model, ...)

## S3 method for class 'kmeans'
cluster_performance(model, ...)

## S3 method for class 'hclust'
cluster_performance(model, data, clusters, ...)

## S3 method for class 'dbscan'
cluster_performance(model, data, ...)

## S3 method for class 'parameters_clusters'
cluster_performance(model, ...)

Arguments

model

Cluster model.

...

Arguments passed to or from other methods.

data

A data.frame.

clusters

A vector with clusters assignments (must be same length as rows in data).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 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
# DBSCAN
if (require("dbscan", quietly = TRUE)) {
  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)

parameters documentation built on Oct. 19, 2021, 1:07 a.m.