def showPredictions():
 for k in range(6):
  tm.reset()
  print (('--- ' + 'ABCDXY'[k]) + ' ---')
  tm.compute(set(seqT[k][:].nonzero()[0].tolist()), learn=False)
  activeColumnsIndices = [tm.columnForCell(i) for i in tm.getActiveCells()]
  predictedColumnIndices = [tm.columnForCell(i) for i in tm.getPredictiveCells()]
  currentColumns = [(1 if (i in activeColumnsIndices) else 0) for i in range(tm.numberOfColumns())]
  predictedColumns = [(1 if (i in predictedColumnIndices) else 0) for i in range(tm.numberOfColumns())]
  print ('Active cols: ' + str(np.nonzero(currentColumns)[0]))
  print ('Predicted cols: ' + str(np.nonzero(predictedColumns)[0]))
  print ''

def showPredictions ( ) : for k in range ( 6 ) : tm . reset ( ) print ( ( '--- ' + 'ABCDXY' [ k ] ) + ' ---' ) tm . compute ( set ( seqT [ k ] [ : ] . nonzero ( ) [ 0 ] . tolist ( ) ) , learn = False ) activeColumnsIndices = [ tm . columnForCell ( i ) for i in tm . getActiveCells ( ) ] predictedColumnIndices = [ tm . columnForCell ( i ) for i in tm . getPredictiveCells ( ) ] currentColumns = [ ( 1 if ( i in activeColumnsIndices ) else 0 ) for i in range ( tm . numberOfColumns ( ) ) ] predictedColumns = [ ( 1 if ( i in predictedColumnIndices ) else 0 ) for i in range ( tm . numberOfColumns ( ) ) ] print ( 'Active cols: ' + str ( np . nonzero ( currentColumns ) [ 0 ] ) ) print ( 'Predicted cols: ' + str ( np . nonzero ( predictedColumns ) [ 0 ] ) ) print ''
shows predictions of the tm when presented with the characters a .