def runClassifier(classifier, sensorRegion, tpRegion, recordNumber):
 actualInput = float(sensorRegion.getOutputData('sourceOut')[0])
 scalarEncoder = sensorRegion.getSelf().encoder.encoders[0][1]
 bucketIndex = scalarEncoder.getBucketIndices(actualInput)[0]
 tpOutput = tpRegion.getOutputData('bottomUpOut').nonzero()[0]
 classDict = {'actValue': actualInput, 'bucketIdx': bucketIndex}
 results = classifier.getSelf().customCompute(recordNum=recordNumber, patternNZ=tpOutput, classification=classDict)
 mostLikelyResult = sorted(zip(results[1], results['actualValues']))[(-1)]
 predictionConfidence = mostLikelyResult[0]
 predictedValue = mostLikelyResult[1]
 return (actualInput, predictedValue, predictionConfidence)

def runClassifier ( classifier , sensorRegion , tpRegion , recordNumber ) : actualInput = float ( sensorRegion . getOutputData ( 'sourceOut' ) [ 0 ] ) scalarEncoder = sensorRegion . getSelf ( ) . encoder . encoders [ 0 ] [ 1 ] bucketIndex = scalarEncoder . getBucketIndices ( actualInput ) [ 0 ] tpOutput = tpRegion . getOutputData ( 'bottomUpOut' ) . nonzero ( ) [ 0 ] classDict = { 'actValue' : actualInput , 'bucketIdx' : bucketIndex } results = classifier . getSelf ( ) . customCompute ( recordNum = recordNumber , patternNZ = tpOutput , classification = classDict ) mostLikelyResult = sorted ( zip ( results [ 1 ] , results [ 'actualValues' ] ) ) [ ( - 1 ) ] predictionConfidence = mostLikelyResult [ 0 ] predictedValue = mostLikelyResult [ 1 ] return ( actualInput , predictedValue , predictionConfidence )
calls classifier manually .