Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anomaly likelihoods with swarmed parameters #3774

Open
wmbm opened this issue Sep 22, 2017 · 4 comments
Open

Anomaly likelihoods with swarmed parameters #3774

wmbm opened this issue Sep 22, 2017 · 4 comments
Assignees
Labels

Comments

@wmbm
Copy link

wmbm commented Sep 22, 2017

Hello everyone,

Using the default model parameters for an OPF model, I get no complaints extracting anomalies from my data. Running a swarmed parameters on my dataset causes the below error. I can get predictions and anomaly scores but anomaly likelihoods create this error.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-4cb531be818f> in <module>()
     49 
     50         anomaly_Likelihood_r = anomaly_likelihood_helper.anomalyProbability(
---> 51             modelInput["value"], anomaly_score_r, modelInput["dttm"]
     52         )
     53 

/usr/local/lib/python2.7/dist-packages/nupic/algorithms/anomaly_likelihood.pyc in anomalyProbability(self, value, anomalyScore, timestamp)
    384         _, _, self._distribution = estimateAnomalyLikelihoods(
    385           self._historicalScores,
--> 386           skipRecords=numSkipRecords)
    387 
    388       likelihoods, _, self._distribution = updateAnomalyLikelihoods(

/usr/local/lib/python2.7/dist-packages/nupic/algorithms/anomaly_likelihood.pyc in estimateAnomalyLikelihoods(anomalyScores, averagingWindow, skipRecords, verbosity)
    458     anomalyScores,
    459     windowSize = averagingWindow,
--> 460     verbosity = verbosity)
    461   s = [r[2] for r in aggRecordList]
    462   dataValues = numpy.array(s)

/usr/local/lib/python2.7/dist-packages/nupic/algorithms/anomaly_likelihood.pyc in _anomalyScoreMovingAverage(anomalyScores, windowSize, verbosity)
    670 
    671     avg, historicalValues, total = (
--> 672       MovingAverage.compute(historicalValues, total, record[2], windowSize)
    673       )
    674 

/usr/local/lib/python2.7/dist-packages/nupic/utils.pyc in compute(slidingWindow, total, newVal, windowSize)
     79 
     80     slidingWindow.append(newVal)
---> 81     total += newVal
     82     return float(total) / len(slidingWindow), slidingWindow, total
     83 

TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType'

My guess so far would be that I haven't correctly defined my swarming definition "search_def.json", but I'm really not too sure.

{
  "includedFields": [
    {
      "fieldName": "dttm", 
      "fieldType": "datetime"
    }, 
    {
      "fieldName": "value", 
      "fieldType": "float"
    }
  ], 
  "streamDef": {
    "info": "test", 
    "version": 1, 
    "streams": [
      {
        "info": "sim_data_mp.csv", 
        "source": "file://myswarm/data/sim_data_mp.csv", 
        "columns": [
          "*"
        ], 
        "last_record": 100
      }
    ], 
    "aggregation": {
      "hours": 1, 
      "microseconds": 0, 
      "seconds": 0, 
      "fields": [
        [
          "value", 
          "sum"
        ], 

        [
          "dttm", 
          "first"
        ]
      ], 
      "weeks": 0, 
      "months": 0, 
      "minutes": 0, 
      "days": 0, 
      "milliseconds": 0, 
      "years": 0
    }
  }, 
  "inferenceType": "TemporalAnomaly", 
  "inferenceArgs": {
    "predictionSteps": [
      1
    ], 
    "predictedField": "value"
  }, 
  "iterationCount": -1, 
  "swarmSize": "medium"
}

Any thoughts about where this is coming from?

Cheers,

@rhyolight
Copy link
Member

Please tell me what version of nupic you are running.

@wmbm
Copy link
Author

wmbm commented Sep 25, 2017

nupic 1.0.4.dev0
nupic.bindings 1.0.0

@rhyolight
Copy link
Member

Is there any way you could isolate this error with as little data as possible and tarball up a clean code example the throws the error?

@carlospc89
Copy link

Did anyone follow up this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants