Model Results¶
ModelResult¶
-
class
nupic.frameworks.opf.opf_utils.
ModelResult
(predictionNumber=None, rawInput=None, sensorInput=None, inferences=None, metrics=None, predictedFieldIdx=None, predictedFieldName=None, classifierInput=None)¶ A structure that contains the input to a model and the resulting predictions as well as any related information related to the predictions.
All params below are accesses as properties of the ModelResult object.
Parameters: - predictionNumber – (int) This should start at 0 and increase with each new ModelResult.
- rawInput – (object) The input record, as input by the user. This is a dictionary-like object which has attributes whose names are the same as the input field names
- sensorInput – (
SensorInput
) object that represents the input record - inferences – (dict) Each key is a
InferenceType
constant which corresponds to the type of prediction being made. Each value is a an element that corresponds to the actual prediction by the model, including auxillary information. - metrics – (
MetricsIface
) The metrics corresponding to the most-recent prediction/ground truth pair - predictedFieldIdx – (int) predicted field index
- predictedFieldName – (string) predicted field name
- classifierInput – (
ClassifierInput
) input from classifier
InferenceShifter¶
-
class
nupic.data.inference_shifter.
InferenceShifter
¶ Shifts time for
ModelResult
objects. This is useful for plotting results with the predictions at the same time step as the input data.-
shift
(modelResult)¶ Shift the model result and return the new instance.
Queues up the T(i+1) prediction value and emits a T(i) input/prediction pair, if possible. E.g., if the previous T(i-1) iteration was learn-only, then we would not have a T(i) prediction in our FIFO and would not be able to emit a meaningful input/prediction pair.
Parameters: modelResult – A ModelResult
instance to shift.Returns: A ModelResult
instance that has been shifted
-