# expected_mutual_information

### cuml.metrics.cluster.expected_mutual_information(contingency, n_samples) → [float](https://docs.python.org/3/builtins/functions.html#float)[[source]](https://github.com/NVIDIA/cuml/blob/20fb4933b/python/cuml/cuml/metrics/cluster/_expected_mutual_information.py#L51)

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:**
  **contingency**
  : 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_samples**
  : The number of samples, i.e. the sum of all the elements of
    `contingency`.
* **Returns:**
  float
  : The expected mutual information, in nats.

<!-- !! processed by numpydoc !! -->
