def estimate(self, item: T) -> int:
     return median([e.estimate(item) for e in self._estimators])
Exemplo n.º 2
0
 def test_exact_median(self):
     for seq in permutations([1, 2, 3]):
         self.assertEqual(2, median(seq))
Exemplo n.º 3
0
 def test_averaged_median(self):
     for seq in permutations([1, 2, 4, 5]):
         self.assertEqual(3, median(seq))
Exemplo n.º 4
0
 def test_median_empty_sequence(self):
     with self.assertRaises(ValueError):
         median([])
 def estimate(self) -> int:
     return median([estimator.estimate() for estimator in self._estimators])