mexter {dprep}R Documentation

External measures for cluster validation

Description

This function computes some external measures for cluster validation

Usage

mexter(true.labels, estimated.labels)

Arguments

true.labels

The observed class labels

estimated.labels

The estimaded class labels

Value

rand

The rand measure

jaccard

The jaccard measure

fandm

The Fowlkes-Mallows measure

hubert

The Hubert measure

Author(s)

Edgar Acuna

Examples

##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (true.labels, estimated.labels) 
{
    ndat = length(true.labels)
    tab <- table(true.labels, estimated.labels)
    nidot <- apply(tab, 1, sum)
    ni2 = sum(nidot^2)
    ndotj <- apply(tab, 2, sum)
    nj2 = sum(ndotj^2)
    z = sum(tab^2)
    num <- z - ndat
    tempo <- (ni2 - ndat) * (nj2 - ndat)
    rdenom = ndat * (ndat - 1)
    return(list(rand = 1 + 2 * (z - 0.5 * (ni2 + nj2))/rdenom, 
        jaccard = num/(ni2 + nj2 - z - ndat), fandm = num/sqrt(tempo), 
        hubert = (rdenom * num - tempo)/sqrt(tempo * (rdenom - 
            ni2 + ndat) * (rdenom - nj2 + ndat))))
  }

[Package dprep version 3.1.1 Index]