mutualInfo#
- swordfish.function.mutualInfo()#
Calculate the mutual information of X and Y.
The calculation uses the following formula:
\(MI(U,V) = \sum\limits_{i = 1}^{|U|}\sum\limits_{j = 1}^{|V|}\dfrac{|{U_i} \cap {V_j}|}{N}log \dfrac{N\lvert{U_i} \cap {V_i}\rvert}{|U_i||V_j|}\)
If X or Y is a matrix, calculate the mutual information of each column and return a vector.
Please note that the natural logarithm is used in this formula. If base is set to 2 or 10, please divide the result by log 2 or log 10.