Learn R Programming

clv (version 0.3-2.1)

connectivity: Connectivity Index - Internal Measure

Description

Function evaluates connectivity index.

Usage

connectivity(data,clust,neighbour.num, dist="euclidean") connectivity.diss.mx(diss.mx,clust,neighbour.num)

Arguments

data
numeric matrix or data.frame where columns correspond to variables and rows to observations
diss.mx
square, symetric numeric matrix or data.frame, representation of dissimilarity matrix where infomartion about distances between objects is stored.
clust
integer vector with information about cluster id the object is assigned to. If vector is not integer type, it will be coerced with warning.
neighbour.num
value which tells how many nearest neighbors for every object should be checked.
dist
chosen metric: "euclidean" (default value), "manhattan", "correlation" (variable enable only in connectivity function).

Value

connectivity returns a connectivity value.

Details

For given data and its partitioning connectivity index is computed. For choosen pattern neighbour.num nearest neighbours are found and sorted from closest to most further. Alghorithm checks if those neighbours are assigned to the same cluster. At the beggining connectivity value is equal 0 and increase with value:
1/i
when i-th nearest neighbour is not assigned to the same cluster,
Procedure is repeated for all patterns which comming from our data set. All values received for particular pattern are added and creates main connectivity index.

References

J. Handl, J. Knowles and D. B. Kell Sumplementary material to computational cluster validation in post-genomic data analysis, http://dbkgroup.org/handl/clustervalidation/supplementary.pdf

Examples

Run this code
# load and prepare data
library(clv)
data(iris)
iris.data <- iris[,1:4]

# cluster data
pam.mod <- pam(iris.data,5) # create five clusters
v.pred <- as.integer(pam.mod$clustering) # get cluster ids associated to gived data objects

# compute connectivity index using data and its clusterization
conn1 <- connectivity(iris.data, v.pred, 10)
conn2 <- connectivity(iris.data, v.pred, 10, dist="manhattan")
conn3 <- connectivity(iris.data, v.pred, 10, dist="correlation")

# the same using dissimilarity matrix
iris.diss.mx <- as.matrix(daisy(iris.data))
conn4 <- connectivity.diss.mx(iris.diss.mx, v.pred, 10)

Run the code above in your browser using DataLab