Permalink
Browse files

Issue #3783: Fixes test to compute pass the probation period (#3786)

  • Loading branch information...
lscheinkman authored and rhyolight committed Jan 3, 2018
1 parent 78e264b commit 41e5a6aefc649b08dbe948ba3e1db46f5aaaa603
Showing with 8 additions and 2 deletions.
  1. +8 −2 tests/unit/nupic/regions/anomaly_likelihood_region_test.py
@@ -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)
@@ -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)

0 comments on commit 41e5a6a

Please sign in to comment.