At first glance, you might simply need to cast "col2" into a float: float(col2). It looks like it might be a string? --------- Matt Taylor OS Community Flag-Bearer Numenta
On Sun, Feb 14, 2016 at 5:36 AM, Wakan Tanka <[email protected]> wrote: > Here is full trace: > > --------------------------------------------------------------------------- > TypeError Traceback (most recent call last) > /home/wakatana/experiments_today/v3/run_nupic.py in <module>() > 239 SWARM_CFG["PREDICTION_STEP"], # PREDICTION > STEP > 240 Verbose=True, # VERBOSE > --> 241 VeryVerbose=False # VERY VERBOSE > 242 ) > 243 RUNMODEL_STOP_TIME = SCRIPT_STOP_TIME = > calendar.timegm(time.gmtime()) > > /home/wakatana/experiments_today/v3/experiments/hot_gym_anomaly/run_model/run_model.py > in runModel(model, inputFile, outputFile, predictionSteps, Verbose, > VeryVerbose) > 67 > 68 # Compute the Anomaly Likelihood > ---> 69 likelihood = anomalyLikelihood.anomalyProbability(col2, tmp, > col1) > 70 logLikelihood = > anomalyLikelihood.computeLogLikelihood(likelihood) > 71 > > /home/wakatana/.local/lib/python2.7/site-packages/nupic-0.3.0.dev0-py2.7-linux-x86_64.egg/nupic/algorithms/anomaly_likelihood.pyc > in anomalyProbability(self, value, anomalyScore, timestamp) > 140 estimateAnomalyLikelihoods( > 141 self._historicalScores, > --> 142 skipRecords = self._claLearningPeriod) > 143 ) > 144 > > /home/wakatana/.local/lib/python2.7/site-packages/nupic-0.3.0.dev0-py2.7-linux-x86_64.egg/nupic/algorithms/anomaly_likelihood.pyc > in estimateAnomalyLikelihoods(anomalyScores, averagingWindow, skipRecords, > verbosity) > 297 metricValues = numpy.array(s) > 298 metricDistribution = estimateNormal(metricValues[skipRecords:], > --> 299 performLowerBoundCheck=False) > 300 > 301 if metricDistribution["variance"] < 1.5e-5: > > /home/wakatana/.local/lib/python2.7/site-packages/nupic-0.3.0.dev0-py2.7-linux-x86_64.egg/nupic/algorithms/anomaly_likelihood.pyc > in estimateNormal(sampleData, performLowerBoundCheck) > 511 params = { > 512 "name": "normal", > --> 513 "mean": numpy.mean(sampleData), > 514 "variance": numpy.var(sampleData), > 515 } > > /usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.pyc in mean(a, axis, > dtype, out, keepdims) > 2714 > 2715 return _methods._mean(a, axis=axis, dtype=dtype, > -> 2716 out=out, keepdims=keepdims) > 2717 > 2718 def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False): > > /usr/lib/python2.7/dist-packages/numpy/core/_methods.pyc in _mean(a, axis, > dtype, out, keepdims) > 60 dtype = mu.dtype('f8') > 61 > ---> 62 ret = um.add.reduce(arr, axis=axis, dtype=dtype, out=out, > keepdims=keepdims) > 63 if isinstance(ret, mu.ndarray): > 64 ret = um.true_divide( > > > TypeError: cannot perform reduce with flexible type > >
