clv.Dens_bw | R Documentation |
Function computes inter-cluster density.
clv.DensBw(data, clust, scatt.obj, dist="euclidean")
data |
|
clust |
integer |
scatt.obj |
object returned by |
dist |
chosen metric: "euclidean" (default value), "manhattan", "correlation" |
The definition of inter-cluster density is given by equation:
Dens_bw
= 1/(|C|*(|C|-1)) * sum{forall i in 1:|C|} sum{forall j in 1:|C| and j != i}
density(u(i,j))/max{density(v(i)), density(v(j))}
where:
|C| | - number of clusters, |
v(i), v(j) | - centers of clusters i and j, |
u(i,j) | - middle point of the line segment defined by the clusters' centers v(i), v(j), |
density(x) | - see below. |
Let define function f(x,u):
f(x,u) = 0 | if dist(x,u) > stdev (stdev is defined in
clv.Scatt ) |
f(x,u) = 1 | otherwise |
Function f is used in definition of density(u):
density(u) = sum{forall i in 1:n(i,j)} f(xi,u)
where n(i,j) is the number of objects which belongs to clusters i and j and xi is such object.
This value is used by clv.SDbw
.
As result Dens_bw
value is returned.
Lukasz Nieweglowski
clv.SD
and clv.SDbw
# load and prepare data
library(clv)
data(iris)
iris.data <- iris[,1:4]
# cluster data
agnes.mod <- agnes(iris.data) # create cluster tree
v.pred <- as.integer(cutree(agnes.mod,5)) # "cut" the tree
# compute Dens_bw index
scatt <- clv.Scatt(iris.data, v.pred)
dens.bw <- clv.DensBw(iris.data, v.pred, scatt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.