コード例 #1
0
 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})
コード例 #2
0
 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})
コード例 #3
0
 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})
コード例 #4
0
 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})
コード例 #5
0
 def testRemoveUnlikelyPredictionsEmpty(self):
     result = HTMPredictionModel._removeUnlikelyPredictions({}, 0.01, 3)
     self.assertDictEqual(result, {})
コード例 #6
0
 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})
コード例 #7
0
 def testRemoveUnlikelyPredictionsEmpty(self):
   result = HTMPredictionModel._removeUnlikelyPredictions({}, 0.01, 3)
   self.assertDictEqual(result, {})