I think I may finally have a lead on this issue!!
So here are the result objects for the first few time steps (resultObj = model.run(modelInput)). This model only has one field (the predicted field ‘media_wear_pct’) with min/max values around 600-100, though the predictions are coming back around ~250. It seems that the ‘bucketIndex’ is becoming the prediction in ‘multiStepPredictions’. Do you have any intuition how/why this might be? Maybe I haven’t properly engaged the classifier? Here is my current code:
**MAIN LOOP:**
results = list()
AnomLikl_obj = anomaly_likelihood.AnomalyLikelihood()
DF_NuPIC = pd.DataFrame(self.DF_input[_inclFIELDS].head(self.numRecords))
for index, row in DF_NuPIC.iterrows():
modelInput = dict()
for field in _inclFIELDS:
modelInput[field] = row[field]
resultObj = model.run(modelInput)
if index < 3:
print(resultObj)
AnomScore = resultObj.inferences["anomalyScore"]
AnomLikl = AnomLikl_obj.anomalyProbability(row[field], AnomScore, timestamp=None)
predFieldVal = row[self.predField]
bestPredictions = resultObj.inferences["multiStepBestPredictions"]
allPredictions = resultObj.inferences["multiStepPredictions"]
oneStep = bestPredictions[1]
**OUTPUT:**
HTM Model Initiated
--> inclFIELD_SET = ['media_wear_pct']
--> Pred Field = media_wear_pct
--> MYENC = ...
('---->', u'media_wear_pct', ' -- ', {'maxval': 1020.0, 'name': 'media_wear_pct', 'clipInput': True, 'minval': 626.14999999999998, 'n': 275, 'fieldname': 'media_wear_pct', 'w': 21, 'type': 'ScalarEncoder'})
('---->', '_classifierInput', ' -- ', {'maxval': 1020.0, 'classifierOnly': True, 'name': 'media_wear_pct', 'clipInput': True, 'minval': 626.14999999999998, 'n': 275, 'fieldname': 'media_wear_pct', 'w': 21, 'type': 'ScalarEncoder'})
('---->', u'media_written_gb', ' -- ', None)
('---->', u'device_temp_c', ' -- ', None)
('---->', u'power_on_hours', ' -- ', None)
('---->', u'write_amp', ' -- ', None)
('---->', u'drive_writes', ' -- ', None)
('---->', u'host_written_gb', ' -- ', None)
('---->', u'host_read_gb', ' -- ', None)
ModelResult( predictionNumber=0
rawInput={'media_wear_pct': 1020.0}
sensorInput=SensorInput( dataRow=(1020.0,)
dataDict={'media_wear_pct': 1020.0}
dataEncodings=[array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1.], dtype=float32)]
sequenceReset=0.0
category=-1
)
inferences={'multiStepPredictions': {1: {254.0: 1.0}}, 'multiStepBucketLikelihoods': {1: {0: 1.0}}, 'multiStepBestPredictions': {1: 254.0}, 'anomalyLabel': '[]', 'anomalyScore': 1.0}
metrics=None
predictedFieldIdx=0
predictedFieldName=media_wear_pct
classifierInput=ClassifierInput( dataRow=1020.0
bucketIndex=254
)
)
index: 0 ---- AScore = 1.0 ---- ALikl = 0.5 ---- predField = 1020.0 ---- 1-Step = 254.0 ---- Conf. = 1.0
ModelResult( predictionNumber=1
rawInput={'media_wear_pct': 1020.0}
sensorInput=SensorInput( dataRow=(1020.0,)
dataDict={'media_wear_pct': 1020.0}
dataEncodings=[array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1.], dtype=float32)]
sequenceReset=0.0
category=-1
)
inferences={'multiStepPredictions': {1: {254.0: 0.99999999999999689}}, 'multiStepBucketLikelihoods': {1: {0: 0.99999999999999689}}, 'multiStepBestPredictions': {1: 254.0}, 'anomalyLabel': '[]', 'anomalyScore': 1.0}
metrics=None
predictedFieldIdx=0
predictedFieldName=media_wear_pct
classifierInput=ClassifierInput( dataRow=1020.0
bucketIndex=254
)
)
index: 1 ---- AScore = 1.0 ---- ALikl = 0.5 ---- predField = 1020.0 ---- 1-Step = 254.0 ---- Conf. = 1.0
ModelResult( predictionNumber=2
rawInput={'media_wear_pct': 1020.0}
sensorInput=SensorInput( dataRow=(1020.0,)
dataDict={'media_wear_pct': 1020.0}
dataEncodings=[array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., 0., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1.], dtype=float32)]
sequenceReset=0.0
category=-1
)
inferences={'multiStepPredictions': {1: {254.0: 1.0}}, 'multiStepBucketLikelihoods': {1: {0: 1.0}}, 'multiStepBestPredictions': {1: 254.0}, 'anomalyLabel': '[]', 'anomalyScore': 1.0}
metrics=None
predictedFieldIdx=0
predictedFieldName=media_wear_pct
classifierInput=ClassifierInput( dataRow=1020.0
bucketIndex=254
)
)
index: 2 ---- AScore = 1.0 ---- ALikl = 0.5 ---- predField = 1020.0 ---- 1-Step = 254.0 ---- Conf. = 1.0
index: 3 ---- AScore = 0.0 ---- ALikl = 0.5 ---- predField = 1020.0 ---- 1-Step = 254.0 ---- Conf. = 1.0
index: 4 ---- AScore = 0.0 ---- ALikl = 0.5 ---- predField = 1020.0 ---- 1-Step = 254.0 ---- Conf. = 1.0