Last active
August 29, 2015 14:26
-
-
Save akelleh/19961f2b16d6bdab56ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from causality.nonparametric.causal_reg import MutualInformation | |
import numpy as np | |
import pandas as pd | |
K = [[1., 0.5, 0.25], | |
[0.5, 1., 0.5], | |
[0.25, 0.5, 1.]] | |
X = np.random.multivariate_normal(mean=[0,0,0],cov=K, size=1000) | |
X = pd.DataFrame(X,columns=['x1','x2','x3']) | |
X.cov() | |
Ihat = MutualInformation() | |
Ihat.estimate(X, ['x1'], ['x2','x3']) | |
# compare with the exact value: | |
# - 0.5 * np.log( 1 - X.corr()['x1']['x2']**2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment