entropy#

cuml.metrics.cluster.entropy(clustering, base=None) float[source]#

cython_entropy(clustering, base=None) -> float

Computes the entropy of a distribution for given probability values.

Parameters:
clusteringarray-like (device or host) shape = (n_samples,)

Clustering of labels. Probabilities are computed based on occurrences of labels. For instance, to represent a fair coin (2 equally possible outcomes), the clustering could be [0,1]. For a biased coin with 2/3 probability for tail, the clustering could be [0, 0, 1].

base: float, optional

The logarithmic base to use, defaults to e (natural logarithm).

Returns:
Sfloat

The calculated entropy.