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

Parameters:
-----------------------------------------------
vectors:        the vectors for which the stability is calculated
numSamples:     the number of time steps where stability is counted

For each window of numSamples, count how many outputs are active during
the entire window.