Learn R Programming

CommKern (version 1.0.1)

purity: Purity

Description

Description of the purity function.

Usage

purity(a, b)

Value

a scalar with the harmonic mean of the purity

Arguments

a

a vector of classifications; this must be a vector of characters, integers, numerics, or a factor, but not a list.

b

a vector of classifications

Details

In information theory, purity is an external evaluation criterion of cluster quality. It is the percent of the total number of objects (data points) that were classified in the range of [0,1]. Because we lack a ground truth partition, a harmonic mean is calculated, where we consider partition a to be the ground truth and then consider partition b to be the ground truth.

See Also

adj_RI, NMI

Examples

Run this code
set.seed(7)
x <- sample(x = rep(1:3, 4), 12)

set.seed(18)
y <- sample(x = rep(1:3, 4), 12)

purity(x,y)

Run the code above in your browser using DataLab