Hi,
Could any one please help me on getting anomalylikelihood?
1: I have input data stream of just timestamp and a field which contains categorical values in string type (I flagged the field with ‘C’).
likelihood = anomalyLikelihood.anomalyProbability(actualValue, anomalyScore, timestamp)
In this code, I put string typed value for the actualValue and it gives error like the followings:
Traceback (most recent call last):
File "D:/PY_WORKSPACE/nupic_inhouse/pretest/run_anomalyDetection.py", line 159, in <module>
runAnomalyDetection(scalar=False)
File "D:/PY_WORKSPACE/nupic_inhouse/pretest/run_anomalyDetection.py", line 137, in runAnomalyDetection
likelihood = anomalyLikelihood.anomalyProbability(actualValue, anomalyScore, timestamp)
File "C:\Python27\lib\site-packages\nupic\algorithms\anomaly_likelihood.py", line 317, in anomalyProbability
skipRecords=numSkipRecords)
File "C:\Python27\lib\site-packages\nupic\algorithms\anomaly_likelihood.py", line 473, in estimateAnomalyLikelihoods
performLowerBoundCheck=False)
File "C:\Python27\lib\site-packages\nupic\algorithms\anomaly_likelihood.py", line 689, in estimateNormal
"mean": numpy.mean(sampleData),
File "C:\Python27\lib\site-packages\numpy\core\fromnumeric.py", line 2942, in mean
out=out, **kwargs)
File "C:\Python27\lib\site-packages\numpy\core\_methods.py", line 65, in _mean
ret = umr_sum(arr, axis, dtype, out, keepdims)
TypeError: cannot perform reduce with flexible type
But with different data stream with a timestamp and a field of float typed values, no errors.
Is there any way to avoid such error with categorical field?
2: How should I put actualValue when I run the anomalyDetection for multiple fields data (want to know anomaly of the combination of two values)?
For example, data looks like below:
c0,c1,c2
datetime,float,float
T,,
2017-01-01 1:00,0,0
2017-01-01 2:00,0.114,0.114
2017-01-01 3:00,0.226,0.228
2017-01-01 4:00,0.336,0.343