示例#1
0
 def test_is_normalized(self):
     values = np.array([[0.7, 0.5], [0.3, 0.5]])
     c = Categorical(values=values)
     self.assertTrue(c.is_normalized())
     values = np.array([[0.2, 0.8], [0.3, 0.5]])
     c = Categorical(values=values)
     self.assertFalse(c.is_normalized())
示例#2
0
 def test_normalize_multi_factor(self):
     values_1 = np.random.rand(5)
     values_2 = np.random.rand(4, 3)
     values = np.array([values_1, values_2])
     c = Categorical(values=values)
     c.normalize()
     self.assertTrue(c.is_normalized())