def percentOutputsStableOverNTimeSteps(vectors, numSamples=None):
 totalSamples = len(vectors)
 windowSize = numSamples
 numWindows = 0
 pctStable = 0
 for wStart in range(0, ((totalSamples - windowSize) + 1)):
  data = vectors[wStart:(wStart + windowSize)]
  outputSums = data.sum(axis=0)
  stableOutputs = (outputSums == windowSize).sum()
  samplePctStable = (float(stableOutputs) / data[0].sum())
  print samplePctStable
  pctStable += samplePctStable
  numWindows += 1
 return (float(pctStable) / numWindows)

def percentOutputsStableOverNTimeSteps ( vectors , numSamples = None ) : totalSamples = len ( vectors ) windowSize = numSamples numWindows = 0 pctStable = 0 for wStart in range ( 0 , ( ( totalSamples - windowSize ) + 1 ) ) : data = vectors [ wStart : ( wStart + windowSize ) ] outputSums = data . sum ( axis = 0 ) stableOutputs = ( outputSums == windowSize ) . sum ( ) samplePctStable = ( float ( stableOutputs ) / data [ 0 ] . sum ( ) ) print samplePctStable pctStable += samplePctStable numWindows += 1 return ( float ( pctStable ) / numWindows )
returns the percent of the outputs that remain completely stable over n time steps .