

def get_independencies(self, condition=None):
    "\n        Returns the independent variables in the joint probability distribution.\n        Returns marginally independent variables if condition=None.\n        Returns conditionally independent variables if condition!=None\n\n        Parameter\n        ---------\n        condition: array_like\n                Random Variable on which to condition the Joint Probability Distribution.\n\n        Examples\n        --------\n        >>> import numpy as np\n        >>> from pgmpy.factors import JointProbabilityDistribution\n        >>> prob = JointProbabilityDistribution(['x1', 'x2', 'x3'], [2, 3, 2], np.ones(12)/12)\n        >>> prob.get_independencies()\n        (x1 _|_ x2)\n        (x1 _|_ x3)\n        (x2 _|_ x3)\n        "
    JPD = self.copy()
    if condition:
        JPD.conditional_distribution(condition)
    independencies = Independencies()
    for variable_pair in itertools.combinations(list(JPD.variables), 2):
        if (JPD.marginal_distribution(variable_pair, inplace=False) == (JPD.marginal_distribution(variable_pair[0], inplace=False) * JPD.marginal_distribution(variable_pair[1], inplace=False))):
            independencies.add_assertions(JPD)
    return independencies

dataset/ETHPy150Open pgmpy/pgmpy/pgmpy/factors/JointProbabilityDistribution.py JointProbabilityDistribution.get_independencies/VarMisuse@112/384 `variable_pair`->`JPD`