expected_mutual_information#
- cuml.metrics.cluster.expected_mutual_information(contingency, n_samples) float[source]#
Calculate the expected mutual information for two labelings.
This is the mutual information expected between two random labelings that have the same cluster sizes as the labelings described by
contingency.- Parameters:
- contingencyarray-like or sparse matrix (device or host) of shape (n_classes_true, n_classes_pred)
The contingency matrix of the two labelings, i.e. the number of samples for each pair of true and predicted labels. Only its row and column sums are used.
- n_samplesint
The number of samples, i.e. the sum of all the elements of
contingency.
- Returns:
- float
The expected mutual information, in nats.