Maximum Correlation
The Hirschfeld–Gebelein–Rényi maximal correlation of a pair of random variables is
subject to zero-mean, unit-variance \(f\) and \(g\). It is 1 if the variables are a deterministic function of each other (a giant bit) and 0 if they are independent.
In [1]: from dit.divergences import maximum_correlation
In [2]: from dit.example_dists import giant_bit, Xor
In [3]: abs(maximum_correlation(giant_bit(2, 2), [[0], [1]]) - 1.0) < 1e-8
Out[3]: True
In [4]: abs(maximum_correlation(Xor(), [[0], [1]])) < 1e-10
Out[4]: True
API
- maximum_correlation(dist, rvs=None, crvs=None)[source]
Compute the (conditional) maximum or Renyi correlation between two variables:
\[\rho^{*} = \max_{f, g} \rho(f(X,Z), g(Y,Z) | Z)\]- Parameters:
dist (Distribution) – The distribution for which the maximum correlation is to computed.
rvs (list, None; len(rvs) == 2) – A list of lists. Each inner list specifies the indexes of the random variables for which the maximum correlation is to be computed. If None, then all random variables are used, which is equivalent to passing rvs=dist.rvs.
crvs (list, None) – A single list of indexes specifying the random variables to condition on. If None, then no variables are conditioned on.
- Returns:
rho_max – The conditional maximum correlation between rvs given crvs.
- Return type:
float; -1 <= rho_max <= 1