Running NAB with scalar encoder only

Hi there,

I’m trying to run NAB on my dataset, and the only thing I want to encode is the “value” field (encoding both the timestamp and the value doesn’t make sense for this dataset).

I can’t figure out how to use the RDSE only. As I can see in _setupEncoderParams() in numenta_detector.py, NAB always encodes both timestamp and value. If I simply put "c0_timeOfDay" : null in best_single_metric_anomaly_params_cpp.json used in getScalarMetricWithTimeOfDayAnomalyParams(), I get an error

Traceback (most recent call last):
File “run.py”, line 210, in
main(args)
File “run.py”, line 69, in main
runner.detect(detectorConstructors)
File “/home/oiegorov/python/projects/NAB-master/nab/runner.py”, line 134, in detect
self.pool.map_async(detectDataSet, args).get(99999999)
File “/usr/lib/python2.7/multiprocessing/pool.py”, line 567, in get
raise self._value
TypeError: ‘NoneType’ object does not support item assignment

Could you please help me with that? I’m so excited about using HTM in my work!

Thanks,
Oleg

1 Like

When you get the model params back from getScalarMetricWithTimeOfDayAnomalyParams, you can change them before creating a model. Look into the params specifically in modelParams.sensorParams.encoders. That is where you want to remove the time stuff.

Well, that was easy :slight_smile: Thank you!

For those who would like to do the same thing, clear all but the “value” entry in the “encoders” dictionary after the line

self._setupEncoderParams(
      modelParams["modelParams"]["sensorParams"]["encoders"])

in numenta_detector.py:

encoder_param = modelParams["modelParams"]["sensorParams"]["encoders"]["value"]
modelParams["modelParams"]["sensorParams"]["encoders"].clear()
modelParams["modelParams"]["sensorParams"]["encoders"]["value"] = encoder_param
1 Like