If you are just interested in anomaly detection on a single scalar value, I would use the parameters returned by getScalarMetricWithTimeOfDayAnomalyParams
, which would be something like this:
{
"inferenceArgs":{
"predictionSteps":[
1
],
"predictedField":"c1",
"inputPredictedField":"auto"
},
"modelConfig":{
"aggregationInfo":{
"seconds":0,
"fields":[
],
"months":0,
"days":0,
"years":0,
"hours":0,
"microseconds":0,
"weeks":0,
"minutes":0,
"milliseconds":0
},
"model":"HTMPrediction",
"version":1,
"predictAheadTime":null,
"modelParams":{
"sensorParams":{
"sensorAutoReset":null,
"encoders":{
"c0_dayOfWeek":null,
"c0_timeOfDay":{
"fieldname":"c0",
"timeOfDay":[
21,
9.49
],
"type":"DateEncoder",
"name":"c0"
},
"c1":{
"name":"c1",
"resolution":0.7692307692307693,
"seed":42,
"fieldname":"c1",
"type":"RandomDistributedScalarEncoder"
},
"c0_weekend":null
},
"verbosity":0
},
"anomalyParams":{
"anomalyCacheRecords":null,
"autoDetectThreshold":null,
"autoDetectWaitRecords":5030
},
"spParams":{
"columnCount":2048,
"synPermInactiveDec":0.0005,
"spatialImp":"cpp",
"inputWidth":0,
"spVerbosity":0,
"synPermConnected":0.2,
"synPermActiveInc":0.003,
"potentialPct":0.8,
"numActiveColumnsPerInhArea":40,
"boostStrength":0.0,
"globalInhibition":1,
"seed":1956
},
"trainSPNetOnlyIfRequested":false,
"clParams":{
"alpha":0.035828933612158,
"verbosity":0,
"steps":"1",
"regionName":"SDRClassifierRegion"
},
"tmParams":{
"columnCount":2048,
"activationThreshold":13,
"pamLength":3,
"cellsPerColumn":32,
"permanenceDec":0.1,
"minThreshold":10,
"inputWidth":2048,
"maxSynapsesPerSegment":32,
"outputType":"normal",
"initialPerm":0.21,
"globalDecay":0.0,
"maxAge":0,
"newSynapseCount":20,
"maxSegmentsPerCell":128,
"permanenceInc":0.1,
"temporalImp":"cpp",
"seed":1960,
"verbosity":0
},
"tmEnable":true,
"clEnable":false,
"spEnable":true,
"inferenceType":"TemporalAnomaly"
}
}
}
These are tuned for anomaly detection on scalar data streams, specifically for min=0, max=5000 (I just ran this function). You’ll need to replace the c0
, c1
values with your field names. I hope that helps?