Newbie question: How to get both anomaly score, anomaly likelihood and predictions

question

#1

Hi,

I’m trying to create a simple model for detecting anomalies in metrics data (very similar to the HotGym case) but I want to get both the anomaly score, anomaly likelihood and the actual predictions.

I saw a quite old video about the anomaly likelihood in which the presenter (I don’t remember his name…) said that the anomaly likelihood is an external mechanism that is not included in the NUPIC framework but might be in the future. What is the current status of this? Is there a good document on how to get the anomaly likelihood.

As for the anomaly and the prediction, I use these model parameters:

MODEL_PARAMS = {
    'model': "HTMPrediction",
    'version': 1,
    'aggregationInfo': {   'days': 0,
        'fields': [('value', 'sum')],
        'hours': 1,
        'microseconds': 0,
        'milliseconds': 0,
        'minutes': 0,
        'months': 0,
        'seconds': 0,
        'weeks': 0,
        'years': 0},
    'predictAheadTime': None,
    'modelParams': {
        'inferenceType': 'TemporalMultiStep',
        'sensorParams': {
            'verbosity' : 0,
            'encoders': {
                u'value':    {
                    'fieldname': u'value',
                    'resolution': 0.88,
                    'seed': 1,
                    'name': u'value',
                    'type': 'RandomDistributedScalarEncoder',
                    },
                'timestamp_timeOfDay': {   'fieldname': u'timestamp',
                                           'name': u'timestamp_timeOfDay',
                                           'timeOfDay': (21, 1),
                                           'type': 'DateEncoder'},
                'timestamp_weekend': {   'fieldname': u'timestamp',
                                         'name': u'timestamp_weekend',
                                         'type': 'DateEncoder',
                                         'weekend': 21}
            },
            'sensorAutoReset': None,
        },
        'spEnable': True,
        'spParams': {
            'spVerbosity': 0,
            'spatialImp': 'cpp',
            'globalInhibition': 1,
            'columnCount': 2048,
            'inputWidth': 0,
            'numActiveColumnsPerInhArea': 40,
            'seed': 1956,
            'potentialPct': 0.85,
            'synPermConnected': 0.1,
            'synPermActiveInc': 0.04,
            'synPermInactiveDec': 0.005,
            'boostStrength': 3.0,
        },
        'tmEnable' : True,
        'tmParams': {
            'verbosity': 0,
            'columnCount': 2048,
            'cellsPerColumn': 32,
            'inputWidth': 2048,
            'seed': 1960,
            'temporalImp': 'cpp',
            'newSynapseCount': 20,
            'maxSynapsesPerSegment': 32,
            'maxSegmentsPerCell': 128,
            'initialPerm': 0.21,
            'permanenceInc': 0.1,
            'permanenceDec': 0.1,
            'globalDecay': 0.0,
            'maxAge': 0,
            'minThreshold': 12,
            'activationThreshold': 16,
            'outputType': 'normal',
            'pamLength': 1,
        },
        'clParams': {
            'regionName': 'SDRClassifierRegion',
            'verbosity': 0,
            'alpha': 0.1,
            'steps': '1,5',
            'implementation': 'cpp',
        },
        'trainSPNetOnlyIfRequested': False,
    },
}

I tried to change the inferenceType to TemporalAnomaly and then I received the anomaly_score but not the prediction and then I changed it to TemporalMultiStep and received the predictions but not the anomaly_score.
Is it possible to receive both?

Thanks a lot,
Yuval


#2

Anomaly likelihood is part of nupic now, there’s a tutorial with code here:

Also, here’s the docs for anomaly detection:

http://nupic.docs.numenta.org/stable/api/algorithms/anomaly-detection.html

Essentially they are just helpers that give you an anomaly likelihood based on the anomaly score, configured to parameters of your choice.


#3

Thanks a lot!!! I’ll try that today and I’ll let you know.

Tnx,

Yuval.