# 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]: from dit.multivariate import tse_complexity

In [2]: from dit.example_dists import Xor

In [3]: d1 = Xor()

In [4]: tse_complexity(d1)
Out[4]: 1.0

In [5]: d2 = dit.Distribution(['000', '111'], [1/2, 1/2])

In [6]: tse_complexity(d2)
Out[6]: 1.0


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(*args, **kwargs)[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’. TSE – The TSE complexity. float ditException – Raised if dist is not a joint distribution or if rvs or crvs contain non-existant random variables.