Learn R Programming

healthcareai (version 1.2.4)

assignClusterLabels: Assign labels to the kmeans confusion matrix

Description

Finds the correct label for a the kmeans confusion matrix. This function assumes that the most populated cluster is the correct one for a given label.

Usage

assignClusterLabels(cm)

Arguments

cm

A square dataframe that holds a confusion matrix. Rownames must correspond to correct labels.

Value

A character vector of the label names.

References

http://healthcare.ai

See Also

healthcareai

Examples

Run this code
# NOT RUN {
data(iris)
head(iris)
kmeans.fit <- kmeans(iris[,1:4],3) 
labs <- iris[,5]
cls <- kmeans.fit[["cluster"]]
cm <- calculateConfusion(labels = labs, clusters = cls)
assignClusterLabels(cm)

# }

Run the code above in your browser using DataLab