# TSE Complexity¶

The Tononi-Sporns-Edelmans (TSE) complexity [TSE94] is a complexity measure for distributions. It is designed so that it maximized by distributions where small subsets of random variables are loosely coupled but the overall distribution is tightly coupled.

$\begin{split}\TSE{X | Z} = \sum_{k=1}^{|X|} \left( {N \choose k}^{-1} \sum_{\substack{y \subseteq X \\ |y| = k}} \left( \H{y | Z} \right) - \frac{k}{|X|}\H{X | Z} \right)\end{split}$

Two distributions which might be considered tightly coupled are the “giant bit” and the “parity” distributions:

In [1]: In [54]: from dit.multivariate import tse_complexity


The TSE Complexity assigns them both a value of $$1.0$$ bits, which is the maximal value the TSE takes over trivariate, binary alphabet distributions.

## API¶

tse_complexity(dist, rvs=None, crvs=None, rv_mode=None)[source]

Calculates the TSE complexity.

Parameters
• dist (Distribution) – The distribution from which the TSE complexity is calculated.

• rvs (list, None) – The indexes of the random variable used to calculate the TSE complexity between. If None, then the TSE complexity 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’.

Returns

TSE – The TSE complexity.

Return type

float

Raises

ditException – Raised if dist is not a joint distribution or if rvs or crvs contain non-existant random variables.