GD43¶
Generalized Dunn's index 43 (GD43).
The Generalized Dunn's indices comprise a set of 17 variants of the original Dunn's index devised to address sensitivity to noise in the latter. The formula of this index is given by:
where \(\delta_r(.)\) is a measure of separation, and \(\Delta_s(.)\) is a measure of compactness, the parameters \(r\) and \(s\) index the measures' formulations. In particular, when employing Euclidean distance, GD43 is formulated using:
and
Attributes¶
-
bigger_is_better
Indicates if a high value is better than a low one or not.
Examples¶
>>> from river import cluster
>>> from river import stream
>>> from river import metrics
>>> X = [
... [1, 2],
... [1, 4],
... [1, 0],
... [4, 2],
... [4, 4],
... [4, 0],
... [-2, 2],
... [-2, 4],
... [-2, 0]
... ]
>>> k_means = cluster.KMeans(n_clusters=3, halflife=0.4, sigma=3, seed=0)
>>> metric = metrics.cluster.GD43()
>>> for x, _ in stream.iter_array(X):
... k_means = k_means.learn_one(x)
... y_pred = k_means.predict_one(x)
... metric = metric.update(x, y_pred, k_means.centers)
>>> metric
GD43: 0.731369
Methods¶
get
Return the current value of the metric.
revert
Revert the metric.
Parameters
- x
- y_pred
- centers
- sample_weight – defaults to
1.0
update
Update the metric.
Parameters
- x
- y_pred
- centers
- sample_weight – defaults to
1.0
works_with
Indicates whether or not a metric can work with a given model.
Parameters
- model (river.base.estimator.Estimator)
References¶
-
J. Bezdek and N. Pal, "Some new indexes of cluster validity," IEEE Trans. Syst., Man, Cybern. B, vol. 28, no. 3, pp. 301–315, Jun. 1998. ↩