Accelerating the pace of engineering and science

# inconsistent

Inconsistency coefficient

## Syntax

Y = inconsistent(Z)
Y = inconsistent(Z,d)

## Description

Y = inconsistent(Z) computes the inconsistency coefficient for each link of the hierarchical cluster tree Z, where Z is an (m-1)-by-3 matrix generated by the linkage function. The inconsistency coefficient characterizes each link in a cluster tree by comparing its height with the average height of other links at the same level of the hierarchy. The higher the value of this coefficient, the less similar the objects connected by the link.

Y = inconsistent(Z,d) computes the inconsistency coefficient for each link in the hierarchical cluster tree Z to depth d, where d is an integer denoting the number of levels of the cluster tree that are included in the calculation. By default, d=2.

The output, Y, is an (m-1)-by-4 matrix formatted as follows.

ColumnDescription

1

Mean of the heights of all the links included in the calculation.

2

Standard deviation of the heights of all the links included in the calculation.

3

Number of links included in the calculation.

4

Inconsistency coefficient.

For each link, k, the inconsistency coefficient is calculated as:

$Y\left(k,4\right)=\left(z\left(k,3\right)-Y\left(k,1\right)\right)/Y\left(k,2\right)$

For leaf nodes, nodes that have no further nodes under them, the inconsistency coefficient is set to 0.

## Examples

expand all

### Compute Inconsistency Coefficient

Create the sample data.

```X = gallery('uniformdata',[10 2],12);
Y = pdist(X);
```

Generate the hierarchical cluster tree.

```Z = linkage(Y,'single');
```

Generate a dendrogram plot of the hierarchical cluster tree.

```dendrogram(Z)
```

Compute the inconsistency coefficient for each link in the cluster tree Z to depth 3.

```W = inconsistent(Z,3)
```
```W =

0.1313         0    1.0000         0
0.1386         0    1.0000         0
0.1463    0.0109    2.0000    0.7071
0.2391         0    1.0000         0
0.1951    0.0568    4.0000    0.9425
0.2308    0.0543    4.0000    0.9320
0.2395    0.0748    4.0000    0.7636
0.2654    0.0945    4.0000    0.9203
0.3769    0.0950    3.0000    1.1040

```

## References

[1] Jain, A., and R. Dubes. Algorithms for Clustering Data. Upper Saddle River, NJ: Prentice-Hall, 1988.

[2] Zahn, C. T. "Graph-theoretical methods for detecting and describing Gestalt clusters." IEEE Transactions on Computers. Vol. C-20, Issue 1, 1971, pp. 68–86.