def testRemoveUnlikelyPredictionsSingleValues(self): result = HTMPredictionModel._removeUnlikelyPredictions({1: 0.1}, 0.01, 3) self.assertDictEqual(result, {1: 0.1}) result = HTMPredictionModel._removeUnlikelyPredictions({1: 0.001}, 0.01, 3) self.assertDictEqual(result, {1: 0.001})
def testRemoveUnlikelyPredictionsComplex(self): result = HTMPredictionModel._removeUnlikelyPredictions( { 1: 0.1, 2: 0.2, 3: 0.3, 4: 0.004 }, 0.01, 3) self.assertDictEqual(result, {1: 0.1, 2: 0.2, 3: 0.3}) result = HTMPredictionModel._removeUnlikelyPredictions( { 1: 0.1, 2: 0.2, 3: 0.3, 4: 0.4, 5: 0.005 }, 0.01, 3) self.assertDictEqual(result, {2: 0.2, 3: 0.3, 4: 0.4}) result = HTMPredictionModel._removeUnlikelyPredictions( { 1: 0.1, 2: 0.2, 3: 0.3, 4: 0.004, 5: 0.005 }, 0.01, 3) self.assertDictEqual(result, {1: 0.1, 2: 0.2, 3: 0.3})
def testRemoveUnlikelyPredictionsMaxPredictions(self): result = HTMPredictionModel._removeUnlikelyPredictions({1: 0.1, 2: 0.2, 3: 0.3}, 0.01, 3) self.assertDictEqual(result, {1: 0.1, 2: 0.2, 3: 0.3}) result = HTMPredictionModel._removeUnlikelyPredictions( {1: 0.1, 2: 0.2, 3: 0.3, 4: 0.4}, 0.01, 3) self.assertDictEqual(result, {2: 0.2, 3: 0.3, 4: 0.4})
def testRemoveUnlikelyPredictionsLikelihoodThresholds(self): result = HTMPredictionModel._removeUnlikelyPredictions({1: 0.1, 2: 0.001}, 0.01, 3) self.assertDictEqual(result, {1: 0.1}) result = HTMPredictionModel._removeUnlikelyPredictions({1: 0.001, 2: 0.002}, 0.01, 3) self.assertDictEqual(result, {2: 0.002}) result = HTMPredictionModel._removeUnlikelyPredictions({1: 0.002, 2: 0.001}, 0.01, 3) self.assertDictEqual(result, {1: 0.002})
def testRemoveUnlikelyPredictionsEmpty(self): result = HTMPredictionModel._removeUnlikelyPredictions({}, 0.01, 3) self.assertDictEqual(result, {})