示例#1
0
 def test_r_variance_columns_with_nans(self):
     """tests the column variance function"""
     matrix = [[np.nan, 0.1234, 0.21370, 0.0342],
               [0.2123, -0.2135, -0.99980, -0.0213],
               [-0.4534, 0.5546, 0.79123, np.nan]]
     result = util.r_variance_columns(matrix)
     self.assertAlmostEqual(0.1661836837, result[0])
     self.assertAlmostEqual(0.1482354433, result[1])
     self.assertAlmostEqual(0.8356519353, result[2])
     self.assertAlmostEqual(0.0011550937, result[3])
示例#2
0
 def test_r_variance_columns(self):
     """tests the column variance function"""
     matrix = [[0.0010, 0.1234, 0.21370, 0.0342],
               [0.2123, -0.2135, -0.99980, -0.0213],
               [-0.4534, 0.5546, 0.79123, 0.00312321]]
     result = util.r_variance_columns(matrix)
     self.assertAlmostEqual(0.1157139233, result[0])
     self.assertAlmostEqual(0.1482354433, result[1])
     self.assertAlmostEqual(0.8356519353, result[2])
     self.assertAlmostEqual(0.0007737516, result[3])