Exemplo n.º 1
0
 def testFindStep_NotSteppishExample(self):
   self.assertIsNone(find_step.FindStep(_NOT_STEPPISH))
   y_values = [y for _, y in _NOT_STEPPISH]
   self.assertEqual(15, find_step._MinimizeDistanceFromStep(y_values))
   self.assertAlmostEqual(
       67.44240311, find_step._DistanceFromStep(y_values, 15))
   self.assertAlmostEqual(
       0.53773162, find_step._RegressionSizeScore(y_values, 15))
Exemplo n.º 2
0
 def testFindStep_QuiteSteppishExample(self):
   self.assertEqual(304772, find_step.FindStep(_QUITE_STEPPISH))
   y_values = [y for _, y in _QUITE_STEPPISH]
   self.assertEqual(21, find_step._MinimizeDistanceFromStep(y_values))
   self.assertAlmostEqual(
       4863.05166991, find_step._DistanceFromStep(y_values, 21))
   self.assertAlmostEqual(
       5.55211054, find_step._RegressionSizeScore(y_values, 21))
Exemplo n.º 3
0
 def testFindStep_NotSteppishExample(self):
   self.assertIsNone(find_step.FindStep(_NOT_STEPPISH))
   y_values = [y for _, y in _NOT_STEPPISH]
   self.assertEqual(15, find_step._MinimizeDistanceFromStep(y_values))
   self.assertAlmostEqual(
       67.44240311, find_step._DistanceFromStep(y_values, 15))
   self.assertAlmostEqual(
       0.53773162, find_step._RegressionSizeScore(y_values, 15))
Exemplo n.º 4
0
 def testFindStep_QuiteSteppishExample(self):
   self.assertEqual(304772, find_step.FindStep(_QUITE_STEPPISH))
   y_values = [y for _, y in _QUITE_STEPPISH]
   self.assertEqual(21, find_step._MinimizeDistanceFromStep(y_values))
   self.assertAlmostEqual(
       4863.05166991, find_step._DistanceFromStep(y_values, 21))
   self.assertAlmostEqual(
       5.55211054, find_step._RegressionSizeScore(y_values, 21))
Exemplo n.º 5
0
 def testDistanceFromStep(self):
   self.assertEqual(0.0, find_step._DistanceFromStep([], 0))
   self.assertEqual(0.0, find_step._DistanceFromStep([0, 1], 1))
   self.assertEqual(0.0, find_step._DistanceFromStep([4, 4, 2, 2], 2))
   self.assertEqual(1.0, find_step._DistanceFromStep([3, 5, 10, 12], 2))
Exemplo n.º 6
0
 def testDistanceFromStep(self):
   self.assertEqual(0.0, find_step._DistanceFromStep([], 0))
   self.assertEqual(0.0, find_step._DistanceFromStep([0, 1], 1))
   self.assertEqual(0.0, find_step._DistanceFromStep([4, 4, 2, 2], 2))
   self.assertEqual(1.0, find_step._DistanceFromStep([3, 5, 10, 12], 2))