NAB icon indicating copy to clipboard operation
NAB copied to clipboard

Unable to run score

Open ritesh99rakesh opened this issue 5 years ago • 11 comments

I was trying to run my own algorithm on the NAB datasets as per option 1 on https://github.com/numenta/NAB/wiki/NAB-Entry-Points Till optimize function, everything works fine but following error occurs while scoring

Running scoring step
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/home/ritesh/NUS/code/NAB/nab/scorer.py", line 165, in scoreDataSet
    return (detectorName, profileName, relativePath, threshold, bestRow.score,
AttributeError: 'NoneType' object has no attribute 'score'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "run.py", line 204, in <module>
    main(args)
  File "run.py", line 77, in main
    runner.score(args.detectors, detectorThresholds)
  File "/home/ritesh/NUS/code/NAB/nab/runner.py", line 208, in score
    scoreFlag))
  File "/home/ritesh/NUS/code/NAB/nab/scorer.py", line 99, in scoreCorpus
    results = pool.map_async(scoreDataSet, args).get(999999)
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
AttributeError: 'NoneType' object has no attribute 'score'

Please help ASAP

ritesh99rakesh avatar Dec 17 '19 10:12 ritesh99rakesh

I got the same problem, but still don't know how to fix it. However, I think there must be something wrong in the scoreDataset function in sweeper.py, cause I found the logic below may return None for matchingRow. And then lead to the problem mentioned above.

    matchingRow = None
    prevRow = None

    for thresholdScore in scoresByThreshold:
      if thresholdScore.threshold == threshold:
        matchingRow = thresholdScore
        break
      elif thresholdScore.threshold < threshold:
        matchingRow = prevRow
        break
      
      prevRow = thresholdScore

liuyuqingNKCS avatar Apr 22 '20 11:04 liuyuqingNKCS

@rhyolight @subutai: Can you please fix this or give a lead as to what is causing the problem mentioned here? Thanks.

bhatiasiddharth avatar Jul 20 '20 19:07 bhatiasiddharth

@rhyolight @subutai: Can you please fix this or give a lead as to what is causing the problem mentioned here? Thanks.

We'll take a look - give us a couple of days. The function may make some assumptions about allowable values.

subutai avatar Jul 22 '20 00:07 subutai

@bhatiasiddharth Can you verify if the anomalyScore returned by your custom detector handleRecord method is a floating point number between 0 and 1?

lscheinkman avatar Jul 22 '20 02:07 lscheinkman

No it is not. Does it need a score between 0 and 1 only?

bhatiasiddharth avatar Jul 22 '20 05:07 bhatiasiddharth

Yes, the raw anomaly score must be a number between 0 and 1.

lscheinkman avatar Jul 22 '20 06:07 lscheinkman

Sure, thanks.

bhatiasiddharth avatar Jul 22 '20 06:07 bhatiasiddharth

Let me know if it works for you

lscheinkman avatar Jul 22 '20 14:07 lscheinkman

Currently, the algorithm I am trying does not give scores between 0 and 1. I need to think how to do it. Once I try, I will let you know. Thanks.

bhatiasiddharth avatar Jul 22 '20 14:07 bhatiasiddharth

Currently, the algorithm I am trying does not give scores between 0 and 1. I need to think how to do it. Once I try, I will let you know. Thanks.

Perhaps you can pass it through a sigmoid, or similar function to get the output in range? As long as it's a monotonic function, it shouldn't matter at all since we are just thresholding the score.

subutai avatar Jul 22 '20 15:07 subutai

Thanks for letting me know. It worked.

bhatiasiddharth avatar Jul 24 '20 16:07 bhatiasiddharth