def testForbesLikeData(self):
    """
    Test with "Forbes-like" data. A bunch of sequences of lengths between 2
    and 10 elements long.

    We will test with both fast and slow learning.

    Make sure PAM allows us to train with fewer repeats of the training data.
    """
    # Cannot use skipIf decorator because it reads SHORT before it is set.
    if SHORT:
      self.skipTest("Test skipped by default. Enable with --long.")

    numOnBitsPerPattern = 3

    # ================================================================
    # Base params
    baseParams = dict(
        # Sequence generation
        seqFunction = buildSequencePool,
        numSequences = 20,
        seqLen = [3,10],
        numPatterns = 10,
        numOnBitsPerPattern = numOnBitsPerPattern,
        patternOverlap = 1,

        # TM construction
        includeCPP = INCLUDE_CPP_TM,
        numCols = None,   # filled in based on generated sequences
        activationThreshold = int(0.8 * numOnBitsPerPattern),
        minThreshold = int(0.8 * numOnBitsPerPattern),
        newSynapseCount = numOnBitsPerPattern,
        initialPerm = 0.51,
        permanenceInc = 0.1,
        permanenceDec = 0.0,
        globalDecay = 0.0,
        pamLength = 0,
        checkSynapseConsistency = False,

        # Training/testing
        nTrainRepetitions = 8,
        doResets = True,
        )


    # ================================================================
    # Run various configs
    # Fast mode, no PAM
    # Fast mode, with PAM
    print "\nRunning without PAM, fast learning, 2 repetitions of the " \
          "training data..."
    self.assertTrue(testConfig(baseParams=baseParams, expMissingMin=50,
                               expMissingMax=None, pamLength=1,
                               nTrainRepetitions=2))

    # Fast mode, with PAM
    print "\nRunning with PAM, fast learning, 2 repetitions of the " \
          "training data..."
    self.assertTrue(testConfig(baseParams=baseParams, expMissingMin=0,
                               expMissingMax=0, pamLength=5,
                               nTrainRepetitions=2))

    # Slow mode, no PAM
    print "\nRunning without PAM, slow learning, 8 repetitions of the " \
          "training data..."
    self.assertTrue(testConfig(baseParams=baseParams, expMissingMin=1,
                               expMissingMax=None, initialPerm=0.31,
                               pamLength=1, nTrainRepetitions=8))

    # Fast mode, with PAM
    print "\nRunning with PAM, slow learning, 8 repetitions of the " \
          "training data..."
    self.assertTrue(testConfig(baseParams=baseParams, expMissingMin=0,
                               expMissingMax=0, initialPerm=0.31, pamLength=5,
                               nTrainRepetitions=8))
def testForbesLikeData ( self ) : if SHORT : self . skipTest ( "Test skipped by default. Enable with --long." ) numOnBitsPerPattern = 3 baseParams = dict ( seqFunction = buildSequencePool , numSequences = 20 , seqLen = [ 3 , 10 ] , numPatterns = 10 , numOnBitsPerPattern = numOnBitsPerPattern , patternOverlap = 1 , includeCPP = INCLUDE_CPP_TM , numCols = None , activationThreshold = int ( 0.8 * numOnBitsPerPattern ) , minThreshold = int ( 0.8 * numOnBitsPerPattern ) , newSynapseCount = numOnBitsPerPattern , initialPerm = 0.51 , permanenceInc = 0.1 , permanenceDec = 0.0 , globalDecay = 0.0 , pamLength = 0 , checkSynapseConsistency = False , nTrainRepetitions = 8 , doResets = True , ) print "\nRunning without PAM, fast learning, 2 repetitions of the " "training data..." self . assertTrue ( testConfig ( baseParams = baseParams , expMissingMin = 50 , expMissingMax = None , pamLength = 1 , nTrainRepetitions = 2 ) ) print "\nRunning with PAM, fast learning, 2 repetitions of the " "training data..." self . assertTrue ( testConfig ( baseParams = baseParams , expMissingMin = 0 , expMissingMax = 0 , pamLength = 5 , nTrainRepetitions = 2 ) ) print "\nRunning without PAM, slow learning, 8 repetitions of the " "training data..." self . assertTrue ( testConfig ( baseParams = baseParams , expMissingMin = 1 , expMissingMax = None , initialPerm = 0.31 , pamLength = 1 , nTrainRepetitions = 8 ) ) print "\nRunning with PAM, slow learning, 8 repetitions of the " "training data..." self . assertTrue ( testConfig ( baseParams = baseParams , expMissingMin = 0 , expMissingMax = 0 , initialPerm = 0.31 , pamLength = 5 , nTrainRepetitions = 8 ) )
Test with "Forbes-like" data. A bunch of sequences of lengths between 2
    and 10 elements long.

    We will test with both fast and slow learning.

    Make sure PAM allows us to train with fewer repeats of the training data.