numenta / nupic-legacy

Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex.
http://numenta.org/
GNU Affero General Public License v3.0
6.33k stars 1.56k forks source link

anomaly_likelihood.estimateNormal() incompatible with coordinate encoder #2124

Open oxtopus opened 9 years ago

oxtopus commented 9 years ago

Don't have a good test case at the moment, but in practice, nupic.algorithms.anomaly_likelihood.AnomalyLikelihood.anomalyProbability() breaks once len(aggRecordList) > skipRecords in https://github.com/numenta/nupic/blob/master/nupic/algorithms/anomaly_likelihood.py#L289 because in estimateNormal() the calculated variance ends up being a numpy array rather than a single scalar value. The result is a very misleading ValueError: "*\ ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()"

Failing a solution, estimateNormal() should fail hard upon encountering an incompatible value rather than let numpy handle it semi-gracefully.

oxtopus commented 9 years ago

I am able to work around by expressing the coords + radius as a single numpy array rather than a 2-tuple of numpy array + radius. See https://github.com/oxtopus/shakehack/commit/1f3d06f98cfde106e8d2cfc726ef47bbdbb18754 for concrete example.