Skip to content

PS

Partition Separation (PS).

The PS index 1 was originally developed for fuzzy clustering. This index only comprises a measure of separation between prototypes. Although classified as a batch clustering validity index (CVI), it can be readily used to evaluate the partitions idenified by unsupervised incremental learners tha model clusters using cenroids.

Larger values of PS indicate better clustering solutions.

The PS value is given by

\[ PS = \sum_{i=1}^k PS_i, \]

where

\[ PS_i = \frac{n_i}{\max_j n_j} - exp \left[ - \frac{\min{i \neq j} (\lVert v_i - v_j \rVert_2^2)}{\beta_T} \right], \]
\[ \beta_T = \frac{1}{k} \sum_{l=1}^k \lVert v_l - \bar{v} \rVert_2 ^2, \]

and

\[ \bar{v} = \frac{1}{k} \sum_{l=1}^k v_l. \]

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.PS()

>>> 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
PS: 1.336026

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


  1. E. Lughofer, "Extensions of vector quantization for incremental clustering," Pattern Recognit., vol. 41, no. 3, pp. 995–1011, Mar. 2008.