def test_factor_divide_invalidvalue(self): phi1 = Factor(['x1', 'x2'], [3, 2], [0.5, 0.2, 0, 0, 0.3, 0.45]) phi2 = Factor(['x1'], [3], [0.8, 0, 0.6]) div = phi1.divide(phi2) np_test.assert_array_equal(div.values, np.array([0.625, 0.25, 0, 0, 0.5, 0.75]))
def test_factor_divide(self): phi1 = Factor(['x1', 'x2'], [2, 2], [1, 2, 2, 4]) phi2 = Factor(['x1'], [2], [1, 2]) div = phi1.divide(phi2) phi3 = Factor(['x1', 'x2'], [2, 2], [1, 2, 1, 2]) self.assertEqual(phi3, div)
def test_factor_divide(self): phi1 = Factor(['x1', 'x2'], [2, 2], [1, 2, 2, 4]) phi2 = Factor(['x1'], [2], [1, 2]) div = phi1.divide(phi2, inplace=False) phi3 = Factor(['x1', 'x2'], [2, 2], [1, 2, 1, 2]) self.assertEqual(phi3, div)
def test_factor_divide_invalid(self): phi1 = Factor(['x1', 'x2'], [2, 2], [1, 2, 3, 4]) phi2 = Factor(['x1'], [2], [0, 2]) div = phi1.divide(phi2, inplace=False) np_test.assert_array_equal(div.values.ravel(), np.array([np.inf, np.inf, 1.5, 2]))