nupic

NuPIC OPF Runtime error getOutputData unknown output categoriesOut


I'm trying to run TemporalClassification model using OPF to recognize patterns from stream. I've adjusted model params so it has two Sensor inputs: ScalarEncoder and SDRCategoryEncoder. The latter marked as classifierOnly. And also it's set as predictedField in inferences.

When trying to feed model with input data I get

RuntimeError: getOutputData unknown output 'categoriesOut' on region Classifier.

NontemporalClassification (only inferenceType changed) model runs without such error.

I've found 6 occurances of categoriesOut in nupic code: https://github.com/numenta/nupic/search?utf8=%E2%9C%93&q=categoriesOut

And error arises in nupic/frameworks/opf/clamodel.py at line 558

classificationDist = classifier.getOutputData('categoriesOut')

Seems that ClassifierRegion in the network is not prepared properly to output data.

Can anyone explain why the classfier region doesn't have 'categoriesOut'? I guess there's misconfiguration in my model params, but there were no errors or warnings during initialization of model. Is there any mandatory parameters and assignments (except noticed in NUPIC documentation) necessary for TemporalClassification model to run?


Solution

  • There are several types of ClassifierRegions in NuPIC. You can find them in nupic/regions folder. I've checked sources and found that 'categoriesOut' is in the outputs dict of the KNNClassifierRegion

    https://github.com/numenta/nupic/blob/469f6372082e95dd5d2a96181b745ba36d2e7a8a/nupic/regions/KNNClassifierRegion.py

    outputs=dict(
    categoriesOut=dict(
    description='A vector representing, for each category '
    'index, the likelihood that the input to the node belongs '
    'to that category based on the number of neighbors of '
    'that category that are among the nearest K.',
    dataType='Real32',
    count=0,
    regionLevel=True,
    isDefaultOutput=True),
    

    Ensure you use KNNClassifierRegion when configuring your TemporalClassification model. Samples for NontemporalClassification use CLAClassifier, but CLAClassifierRegion has no categoriesOut in its outputs and error described in your question will arise if you keep

    'regionName' : 'CLAClassifierRegion'
    

    for TemporalClassification model.