Learn R Programming

healthcareai (version 1.2.4)

calculateConfusion: Generate confusion matrix of percentages

Description

Generate confusion matrix and convert from raw counts to percentage of each label

Usage

calculateConfusion(labels, clusters)

Arguments

labels

A vector with countable unique items, usually a factor variable in a data frame, labeling each observation.

clusters

A vector with countable unique items, usually is the clustering results returned by kmeans(), No NA's.

Value

A confusion matrix of percentages.

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"]]
calculateConfusion(labels = labs, clusters = cls)

# }

Run the code above in your browser using DataLab