Skip to content

Commit

Permalink
Issue numenta#3783: Fixes test to compute pass the probation period
Browse files Browse the repository at this point in the history
  • Loading branch information
lscheinkman committed Jan 2, 2018
1 parent 1aea72a commit 5f5da49
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/unit/nupic/regions/anomaly_likelihood_region_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,13 @@ def testSerialization(self):
anomalyLikelihoodRegion1 = AnomalyLikelihoodRegion()
inputs = AnomalyLikelihoodRegion.getSpec()['inputs']
outputs = AnomalyLikelihoodRegion.getSpec()['outputs']
parameters = AnomalyLikelihoodRegion.getSpec()['parameters']

for _ in xrange(0, 6):
# Make sure to calculate distribution by passing the probation period
learningPeriod = parameters['learningPeriod']['defaultValue']
reestimationPeriod = parameters['reestimationPeriod']['defaultValue']
probation = learningPeriod + reestimationPeriod
for _ in xrange(0, probation + 1):
inputs['rawAnomalyScore'] = numpy.array([random.random()])
inputs['metricValue'] = numpy.array([random.random()])
anomalyLikelihoodRegion1.compute(inputs, outputs)
Expand All @@ -110,7 +115,8 @@ def testSerialization(self):
anomalyLikelihoodRegion2 = AnomalyLikelihoodRegion.read(proto2)
self.assertEqual(anomalyLikelihoodRegion1, anomalyLikelihoodRegion2)

for _ in xrange(6, 500):
window = parameters['historicWindowSize']['defaultValue']
for _ in xrange(0, window + 1):
inputs['rawAnomalyScore'] = numpy.array([random.random()])
inputs['metricValue'] = numpy.array([random.random()])
anomalyLikelihoodRegion1.compute(inputs, outputs)
Expand Down

0 comments on commit 5f5da49

Please sign in to comment.