def profileSP(spClass, spDim, nRuns):
 inDim = [10000, 1, 1]
 colDim = [spDim, 1, 1]
 sp = spClass(inputDimensions=inDim, columnDimensions=colDim, potentialRadius=3, potentialPct=0.5, globalInhibition=False, localAreaDensity=(-1.0), numActiveColumnsPerInhArea=3, stimulusThreshold=1, synPermInactiveDec=0.01, synPermActiveInc=0.1, synPermConnected=0.1, minPctOverlapDutyCycle=0.1, dutyCyclePeriod=10, boostStrength=10.0, seed=42, spVerbosity=0)
 dataDim = inDim
 dataDim.append(nRuns)
 data = numpy.random.randint(0, 2, dataDim).astype('float32')
 for i in xrange(nRuns):
  d = data[:, :, :, i]
  activeArray = numpy.zeros(colDim)
  sp.compute(d, True, activeArray)

def profileSP ( spClass , spDim , nRuns ) : inDim = [ 10000 , 1 , 1 ] colDim = [ spDim , 1 , 1 ] sp = spClass ( inputDimensions = inDim , columnDimensions = colDim , potentialRadius = 3 , potentialPct = 0.5 , globalInhibition = False , localAreaDensity = ( - 1.0 ) , numActiveColumnsPerInhArea = 3 , stimulusThreshold = 1 , synPermInactiveDec = 0.01 , synPermActiveInc = 0.1 , synPermConnected = 0.1 , minPctOverlapDutyCycle = 0.1 , dutyCyclePeriod = 10 , boostStrength = 10.0 , seed = 42 , spVerbosity = 0 ) dataDim = inDim dataDim . append ( nRuns ) data = numpy . random . randint ( 0 , 2 , dataDim ) . astype ( 'float32' ) for i in xrange ( nRuns ) : d = data [ : , : , : , i ] activeArray = numpy . zeros ( colDim ) sp . compute ( d , True , activeArray )
profiling performance of spatialpooler using the python cprofile module and ordered by cumulative time .