Beispiel #1
0
  def run(self, inputRecord):
    """ run one iteration of this model.
        args:
            inputRecord is a record object formatted according to
                nupic.data.FileSource.getNext() result format.

        return:
            An ModelResult namedtuple (see opfutils.py) The contents of
            ModelResult.inferences depends on the the specific inference type
            of this model, which can be queried by getInferenceType()
    """
    if hasattr(self, '_numPredictions'):
      predictionNumber = self._numPredictions
      self._numPredictions += 1
    else:
      predictionNumber = None
    result = opfutils.ModelResult(predictionNumber=predictionNumber,
                                  rawInput=inputRecord)
    return result
Beispiel #2
0
 def run(self, inputRecord):
     """ Run one iteration of this model.
 @param inputRecord (object)
        A record object formatted according to
        nupic.data.record_stream.RecordStreamIface.getNextRecord() or
        nupic.data.record_stream.RecordStreamIface.getNextRecordDict()
        result format.
 @returns (nupic.frameworks.opf.opfutils.ModelResult)
          An ModelResult namedtuple. The contents of ModelResult.inferences
          depends on the the specific inference type of this model, which
          can be queried by getInferenceType()
 """
     if hasattr(self, '_numPredictions'):
         predictionNumber = self._numPredictions
         self._numPredictions += 1
     else:
         predictionNumber = None
     result = opfutils.ModelResult(predictionNumber=predictionNumber,
                                   rawInput=inputRecord)
     return result