mutual_info: Mutual Information

Description Usage Arguments Details References Examples

View source: R/mutual_info.R

Description

Calculates Variants of the mutual information of the rows and the columns of a cross table

Usage

1
mutual_info(x, normalized = "none", adjusted = FALSE)

Arguments

x

a cross table of frequencies; has to be a integer matrix or table object

normalized

a string that specifies how the mutual information should be normalized. Must be one of either "none", "min", "max", "arithmetic", "geometric", or "harmonic."

adjusted

if TRUE, calculates the adjusted version based on the hypergeometric model of randomness. Defaults to FALSE

Details

The normalized option specifies how the row and column entropies are used to normalize the mutual information. For example, with "min", the normalized mutual information (NMI) would be I(R, C) / \min[H(R), H(C)], where I(R, C) is the mutual information between the row and the column, and H(R) and H(C), respectively, are entropies of the row and column marginals. When adjusted is set to TRUE, the adjusted mutual information, as suggested by Vinh et al. (2010), is returned. If what == "none" and adjusted == TRUE, the function returns I(R,C) - E[I(R,C)].

References

Nguyen Xuan Vinh, Julien Epps, and James Bailey. 2010. "Information Theoretic Measures for Clusterings Comparison: Variants, Properties, Normalization and Correction for Chance," Journal of Machine Learning Research 11: 2837-2854.

Examples

1
2
3
4
5
6
7
data(sampson3, package = "btoolbox")

info_part = igraph::cluster_infomap(sampson3)
groups = igraph::vertex_attr(sampson3, "group")
print(tab <- table(groups, info_part$membership))

mutual_info(tab, normalize = "geometric", adjusted = TRUE)

baruuum/btoolbox documentation built on Aug. 17, 2020, 1:29 a.m.