How to use the causality.inference.independence_tests.MutualInformationTest function in causality

To help you get started, we’ve selected a few causality examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github akelleh / causality / tests / unit / test_cit.py View on Github external
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)))
github akelleh / causality / tests / unit / test_cit.py View on Github external
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