def test_BinaryFeatures_SkipNormalization(self): x = [[0, 0, 5], [1, 1, 6], [1, -1, 7], [0, 0, 8]] x = np.array(x, dtype=np.float) meanX, stdX = meanstdX(x) self.assertEqual(meanX[0], 0) self.assertEqual(meanX[1], 0) self.assertNotEqual(meanX[2], 0) self.assertEqual(stdX[0], 1) self.assertEqual(stdX[1], 1) self.assertNotEqual(stdX[2], 1)
def test_meanstdX_GetMeanStd(self): x = [[1, 2], [3, 4], [5, 6]] m, s = meanstdX(x) x1 = np.array(x) self.assertTrue(np.allclose(m, x1.mean(0))) self.assertTrue(np.allclose(s, x1.std(0)))