# model = runMultiplePassSPonly(df, model, nMultiplePass, nTrain)

  maxBucket = classifier_encoder.n - classifier_encoder.w + 1
  likelihoodsVecAll = np.zeros((maxBucket, len(df)))

  prediction_nstep = None
  time_step = []
  actual_data = []
  patternNZ_track = []
  predict_data = np.zeros((_options.stepsAhead, 0))
  predict_data_ML = []
  negLL_track = []

  activeCellNum = []
  trueBucketIndex = []
  sp = model._getSPRegion().getSelf()._sfdr
  spActiveCellsCount = np.zeros(sp.getColumnDimensions())

  for i in xrange(len(df)):
    inputRecord = getInputRecord(df, predictedField, i)
    result = model.run(inputRecord)
    trueBucketIndex.append(model._getClassifierInputRecord(inputRecord).bucketIndex)

    # inspect SP
    sp = model._getSPRegion().getSelf()._sfdr
    spOutput = model._getSPRegion().getOutputData('bottomUpOut')
    spActiveCellsCount[spOutput.nonzero()[0]] += 1

    tp = model._getTPRegion()
    tm = tp.getSelf()._tfdr
    activeColumn = tm.getActiveCells()
示例#2
0
    likelihoodsVecAll = np.zeros((maxBucket, len(df)))

    prediction_nstep = None
    time_step = []
    actual_data = []
    patternNZ_track = []
    predict_data = np.zeros((_options.stepsAhead, 0))
    predict_data_ML = []
    negLL_track = []

    activeCellNum = []
    predCellNum = []
    predSegmentNum = []
    predictedActiveColumnsNum = []
    trueBucketIndex = []
    sp = model._getSPRegion().getSelf()._sfdr
    spActiveCellsCount = np.zeros(sp.getColumnDimensions())

    output = nupic_output.NuPICFileOutput([dataSet])

    for i in xrange(len(df)):
        inputRecord = getInputRecord(df, predictedField, i)
        tp = model._getTPRegion()
        tm = tp.getSelf()._tfdr
        prePredictiveCells = tm.getPredictiveCells()
        prePredictiveColumn = np.array(
            list(prePredictiveCells)) / tm.cellsPerColumn

        result = model.run(inputRecord)
        trueBucketIndex.append(
            model._getClassifierInputRecord(inputRecord).bucketIndex)
示例#3
0
  likelihoodsVecAllNN = np.zeros((maxBucket, len(df)))

  predictionNstep = None
  timeStep = []
  actualData = []
  patternNZTrack = []
  predictData = np.zeros((_options.stepsAhead, 0))
  predictDataCLA = []
  predictDataNN = []
  negLLTrack = []

  activeCellNum = []
  predCellNum = []
  predictedActiveColumnsNum = []
  trueBucketIndex = []
  sp = model._getSPRegion().getSelf()._sfdr
  spActiveCellsCount = np.zeros(sp.getColumnDimensions())

  if noise > 0:
    datasetName = dataSet + "noise_{:.2f}".format(noise)
  else:
    datasetName = dataSet

  output = nupic_output.NuPICFileOutput([datasetName])

  for i in xrange(len(df)):
    inputRecord = getInputRecord(df, predictedField, i, noise)
    tp = model._getTPRegion()
    tm = tp.getSelf()._tfdr
    prePredictiveCells = tm.predictiveCells
    prePredictiveColumn = np.array(list(prePredictiveCells)) / tm.cellsPerColumn