示例#1
0
 def test_moment(self):
     # Returns 0.0 (1st central moment = 0.0).
     v = metrics.moment([1,2,3,4,5], k=1)
     self.assertEqual(v, 0.0)
     # Returns 2.0 (2nd central moment = population variance).
     v = metrics.moment([1,2,3,4,5], k=2)
     self.assertEqual(v, 2.0)
示例#2
0
 def test_moment(self):
     # Assert 0.0 (1st central moment = 0.0).
     v = metrics.moment([1,2,3,4,5], n=1)
     self.assertEqual(v, 0.0)
     # Assert 2.0 (2nd central moment = population variance).
     v = metrics.moment([1,2,3,4,5], n=2)
     self.assertEqual(v, 2.0)
     print("pattern.metrics.moment()")
示例#3
0
 def test_moment(self):
     # Assert 0.0 (1st central moment = 0.0).
     v = metrics.moment([1, 2, 3, 4, 5], n=1)
     self.assertEqual(v, 0.0)
     # Assert 2.0 (2nd central moment = population variance).
     v = metrics.moment([1, 2, 3, 4, 5], n=2)
     self.assertEqual(v, 2.0)
     print("pattern.metrics.moment()")