# Interaction Information¶

The interaction information is equal in magnitude to the Co-Information, but has the opposite sign when taken over an odd number of variables:

$\II{X_{0:n}} = (-1)^{n} \cdot \I{X_{0:n}}$

Interaction information was first studied in the 3-variable case which, for $$X_{0:3} = X_0X_1X_2$$, takes the following form:

$\II{X_0 : X_1 : X_2} = \I{X_0 : X_1 | X_2} - \I{X_0 : X_1}$

The extension to $$n > 3$$ proceeds recursively. For example,

$\begin{split}\II{X_0 : X_1 : X_2 : X_3} &= \II{X_0 : X_1 : X_2 | X_3} - \II{X_0 : X_1 : X_2} \\ &= \I{X_0 : X_1 | X_2, X_3} - \I{X_0 : X_1 | X_3} \\ &\qquad - \I{X_0 : X_1 | X_2} + \I{X_0 : X_1}\end{split}$

interaction_information(*args, **kwargs)[source]
Parameters: dist (Distribution) – The distribution from which the interaction information is calculated. rvs (list, None) – The indexes of the random variable used to calculate the interaction information between. If None, then the interaction information is calculated over all random variables. crvs (list, None) – The indexes of the random variables to condition on. If None, then no variables are condition on. rv_mode (str, None) – Specifies how to interpret rvs and crvs. Valid options are: {‘indices’, ‘names’}. If equal to ‘indices’, then the elements of crvs and rvs are interpreted as random variable indices. If equal to ‘names’, the the elements are interpreted as random variable names. If None, then the value of dist._rv_mode is consulted, which defaults to ‘indices’. II – The interaction information. float ditException – Raised if dist is not a joint distribution or if rvs or crvs contain non-existant random variables.