pyphi.measures.distribution.emd#

pyphi.measures.distribution.emd(p, q, direction=None)[source]#

Compute the EMD between two repertoires for a given direction.

The full EMD computation (hamming_emd()) is used for cause repertoires. A fast analytic solution (effect_emd()) is used for effect repertoires, exploiting the independence of the nodes in an effect repertoire.

Parameters:
  • p (np.ndarray) – The first repertoire.

  • q (np.ndarray) – The second repertoire.

  • direction (Direction or None) – CAUSE or EFFECT. If EFFECT, effect_emd() is used; otherwise hamming_emd() is used. None is treated as CAUSE.

Returns:

DistanceResult – The EMD between p and q, carrying method="EMD" and the direction as metadata. The value is not rounded.

Raises:

ValueError – If direction is invalid.

Return type:

float