def TestH2a(sequenceLength, nTests, cellsPerColumn, numCols =<NUM_LIT:100>, nSequences =[<NUM_LIT:2>],<EOL>pctShared = <NUM_LIT>, seqGenMode = '<STR_LIT>',<EOL>shouldFail = False):
print("<STR_LIT>")<EOL>nFailed = <NUM_LIT:0><EOL>subsequenceStartPos = <NUM_LIT:10><EOL>assert subsequenceStartPos < sequenceLength<EOL>for numSequences in nSequences:<EOL><INDENT>print("<STR_LIT>",sequenceLength, end='<STR_LIT:U+0020>')<EOL>print("<STR_LIT>",cellsPerColumn,"<STR_LIT>",nTests,"<STR_LIT>", numCols)<EOL>print("<STR_LIT>",numSequences, "<STR_LIT>", pctShared, end='<STR_LIT:U+0020>')<EOL>print("<STR_LIT>", seqGenMode)<EOL>for _ in range(nTests): <EOL><INDENT>trainingSet = buildTrainingSet(numSequences = numSequences,<EOL>sequenceLength = sequenceLength,<EOL>pctShared = pctShared, seqGenMode = seqGenMode,<EOL>subsequenceStartPos = subsequenceStartPos,<EOL>numCols = numCols,<EOL>minOnes = <NUM_LIT>, maxOnes = <NUM_LIT>)<EOL>print("<STR_LIT>")<EOL>numFailures3, numStrictErrors3, numPerfect3, tm3 =testSequence(trainingSet,<EOL>nTrainingReps = <NUM_LIT:10>,<EOL>numberOfCols = numCols,<EOL>cellsPerColumn = cellsPerColumn,<EOL>initialPerm = <NUM_LIT>,<EOL>connectedPerm = <NUM_LIT>,<EOL>minThreshold = <NUM_LIT:12>,<EOL>permanenceInc = <NUM_LIT>,<EOL>permanenceDec = <NUM_LIT:0.1>,<EOL>permanenceMax = <NUM_LIT:1>,<EOL>globalDecay = <NUM_LIT>,<EOL>newSynapseCount = <NUM_LIT:15>,<EOL>activationThreshold = <NUM_LIT:12>,<EOL>doPooling = False,<EOL>shouldFail = shouldFail)<EOL>print("<STR_LIT>")<EOL>numFailures, numStrictErrors, numPerfect, tm2 =testSequence(trainingSet,<EOL>nTrainingReps = <NUM_LIT:2>,<EOL>numberOfCols = numCols,<EOL>cellsPerColumn = cellsPerColumn,<EOL>initialPerm = <NUM_LIT>,<EOL>connectedPerm = <NUM_LIT>,<EOL>minThreshold = <NUM_LIT:12>,<EOL>permanenceInc = <NUM_LIT>,<EOL>permanenceDec = <NUM_LIT:0>,<EOL>permanenceMax = <NUM_LIT:1>,<EOL>globalDecay = <NUM_LIT>,<EOL>newSynapseCount = <NUM_LIT:15>,<EOL>activationThreshold = <NUM_LIT:12>,<EOL>doPooling = False,<EOL>shouldFail = shouldFail)<EOL>print("<STR_LIT>")<EOL>numFailures1, numStrictErrors1, numPerfect1, tm1 =testSequence(trainingSet,<EOL>nTrainingReps = <NUM_LIT:1>,<EOL>numberOfCols = numCols,<EOL>cellsPerColumn = cellsPerColumn,<EOL>initialPerm = <NUM_LIT>,<EOL>connectedPerm = <NUM_LIT>,<EOL>minThreshold = <NUM_LIT:12>,<EOL>permanenceInc = <NUM_LIT>,<EOL>permanenceDec = <NUM_LIT:0>,<EOL>permanenceMax = <NUM_LIT:1>,<EOL>globalDecay = <NUM_LIT>,<EOL>newSynapseCount = <NUM_LIT:15>,<EOL>activationThreshold = <NUM_LIT:12>,<EOL>doPooling = False,<EOL>shouldFail = shouldFail)<EOL>segmentInfo1 = tm1.getSegmentInfo()<EOL>segmentInfo2 = tm2.getSegmentInfo()<EOL>if (abs(segmentInfo1[<NUM_LIT:0>] - segmentInfo2[<NUM_LIT:0>]) > <NUM_LIT:3>) or(abs(segmentInfo1[<NUM_LIT:1>] - segmentInfo2[<NUM_LIT:1>]) > <NUM_LIT:3>*<NUM_LIT:15>) :<EOL><INDENT>print("<STR_LIT>")<EOL>print(segmentInfo1)<EOL>print(segmentInfo2)<EOL>print(tm3.getSegmentInfo())<EOL>tm3.trimSegments()<EOL>print(tm3.getSegmentInfo())<EOL>print("<STR_LIT>")<EOL>print(numFailures1, numStrictErrors1, numPerfect1)<EOL>print(numFailures, numStrictErrors, numPerfect)<EOL>print(numFailures3, numStrictErrors3, numPerfect3)<EOL>numFailures += <NUM_LIT:1><EOL><DEDENT>if numFailures == <NUM_LIT:0> and not shouldFailor numFailures > <NUM_LIT:0> and shouldFail:<EOL><INDENT>print("<STR_LIT>", end='<STR_LIT:U+0020>')<EOL>if shouldFail:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>print()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>print("<STR_LIT>")<EOL>nFailed = nFailed + <NUM_LIT:1><EOL>print("<STR_LIT>", numFailures)<EOL>print("<STR_LIT>", numStrictErrors)<EOL>print("<STR_LIT>", numPerfect)<EOL><DEDENT><DEDENT><DEDENT>return nFailed<EOL>
Still need to test:
    Two overlapping sequences. OK to get new segments but check that we can
    get correct high order prediction after multiple reps.