pgmpy.factors.factor_divide#
- pgmpy.factors.factor_divide(phi1, phi2)[source]#
Returns DiscreteFactor representing phi1 / phi2.
- Parameters:
- phi1: Factor
The Dividend.
- phi2: Factor
The Divisor.
- Returns:
- DiscreteFactor: DiscreteFactor representing factor division phi1 / phi2.
Examples
>>> from pgmpy.factors.discrete import DiscreteFactor >>> from pgmpy.factors import factor_product >>> phi1 = DiscreteFactor(["x1", "x2", "x3"], [2, 3, 2], range(12)) >>> phi2 = DiscreteFactor(["x3", "x1"], [2, 2], range(1, 5)) >>> phi = factor_divide(phi1, phi2) >>> phi.variables ['x1', 'x2', 'x3'] >>> phi.cardinality array([2, 3, 2]) >>> phi.values array([[[0. , 0.33333333], [2. , 1. ], [4. , 1.66666667]], [[3. , 1.75 ], [4. , 2.25 ], [5. , 2.75 ]]])