size = 2000
X_1 = np.random.rand(size)
Y_1 = np.random.randn(size)

test_ind = HSIC_b(X_1, Y_1, kernel='exponential')

test_ind.empirical_test()

test_ind.p_value

test_ind_r = dHSIC(X_1, Y_1)

print test_ind_r.res

test_ind_r.statistic

test_ind_r.p_value

"""
Explanation: Test independent
H0: Independent
H1: Not Independent
Should not reject H0
End of explanation
"""


size = 200
X_2 = np.random.normal(0,10,size)
Y_2 = X_2

test_non = HSIC_b(X_2, Y_2, kernel='exponential')

test_non.empirical_test()

test_non.p_value

test_non_r = dHSIC(X_2, Y_2)

print test_non_r.res

test_non_r.statistic

test_non_r.p_value

"""
Explanation: Test NOT independent
H0: Independent
H1: Not Independent
Should reject H0
End of explanation
"""


SIZE = 500
Z = np.random.randn(SIZE) * 100
X = Z + np.random.randn(SIZE)
Y = Z + np.random.randn(SIZE)

Z_vars = np.array(['Z'])

data = pd.DataFrame(np.array([X, Y, Z]).T, columns=["X", "Y", "Z"])

ci = CI('X', 'Y', ['Z'], data, 'cor')

ci.statistic

ci.p_value

"""
Explanation: Conditional Independence Test
Conditional Independent variables
H0: Conditionallly Independent
H1: Not Conditionally Independent
Should not reject H0
End of explanation
"""


SIZE = 500
Z = np.random.randn(SIZE) * 100
X = np.random.randn(SIZE)
Y = X

Z_vars = np.array(['Z'])

data = pd.DataFrame(np.array([X, Y, Z]).T, columns=["X", "Y", "Z"])

ci = CI('X', 'Y', ['Z'], data, 'cor')

ci.statistic

ci.p_value

"""
Explanation: Not conditional Independent variables
H0: Conditionallly Independent
H1: Not Conditionally Independent
Should reject H0
End of explanation
"""


