Learn R Programming

tiger (version 0.2.3.1)

validityIndex: Validity Index for fuzzy clustering

Description

Calculate the validity index for fuzzy clusters. A validity index below 1 indicates, that in between clusters is larger than within clusters. Evaluating the validity index for various numbers of desired clusters may help to find the minimum.

Usage

validityIndex(cclust, values, verbose = FALSE)

Arguments

cclust
object returned from cmeans
values
data provided as x to cmeans
verbose
boolean. If true, values for numerator and denominater are printed.

Value

A single number, the validity index.

References

Reusser, D. E., Blume, T., Schaefli, B., and Zehe, E.: Analysing the temporal dynamics of model performance for hydrological models, Hydrol. Earth Syst. Sci. Discuss., 5, 3169-3211, 2008.

Xie, X. and Beni, G.: A validity measure for fuzzy clustering, IEEE T. Pattern Anal., 13, 841-847, 1991. 3181

See Also

cmeans for the fuzzy clustering itself

Examples

Run this code
myOrig <- matrix(c(c(1,0,0,1),
         c(0,0,1,2),
         c(1,1,0,3)), nrow=3, ncol=4, byrow=TRUE)


myData <- rbind(
     matrix(myOrig[1,], nrow=50, ncol=4, byrow=TRUE),
     matrix(myOrig[2,], nrow=50, ncol=4, byrow=TRUE),
     matrix(myOrig[3,], nrow=50, ncol=4, byrow=TRUE)
     )
str(myData)
myData[,1:3] <- myData[,1:3] + rnorm(3*150)*0.3
myData

maxc <- 10

require(e1071)
    validity <- rep(NA, maxc)
    all.cluster.rer <- list()
    for(centers in 2:maxc){
        cluster.rer<-cmeans(x=myData, centers=centers, method="cmeans", m=2)
        validity[centers] <- validityIndex(cluster.rer , myData)
        all.cluster.rer[[centers]] <- cluster.rer
    }

  plot(validity, type="l")
 

Run the code above in your browser using DataLab