Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
y = ['x3']
x = ['x1']
z = ['x2']
test = MutualInformationTest(y, x, z, self.X, self.alpha, variable_types=self.variable_types)
assert(test.independent())
y = ['x3']
x = ['x1']
z = []
test = MutualInformationTest(y, x, z, self.X, self.alpha, variable_types=self.variable_types)
assert(not test.independent())
y = ['x1']
x = ['x1']
z = []
test = MutualInformationTest(y, x, z, self.X, self.alpha, variable_types=self.variable_types)
assert(not test.independent())
I, dI = test.max_likelihood_information(x, y, self.X)
z = 1.96
assert((numpy.exp(I-z*dI) < 5) and (5 < numpy.exp(I+z*dI)))
def test_mi(self):
y = ['x3']
x = ['x1']
z = ['x2']
test = MutualInformationTest(y, x, z, self.X, self.alpha, variable_types=self.variable_types)
assert(test.independent())
y = ['x3']
x = ['x1']
z = []
test = MutualInformationTest(y, x, z, self.X, self.alpha, variable_types=self.variable_types)
assert(not test.independent())
y = ['x1']
x = ['x1']
z = []
test = MutualInformationTest(y, x, z, self.X, self.alpha, variable_types=self.variable_types)
assert(not test.independent())
I, dI = test.max_likelihood_information(x, y, self.X)
z = 1.96