Ejemplo n.º 1
0
  def __init__(self,
               numberOfCols =500,
               burnIn =2,             # Used for evaluating the prediction score
               collectStats =False,   # If true, collect training and inference stats
               seed =42,
               verbosity =VERBOSITY,
               predictionMethod = 'random',  # "random" or "zeroth"
               **kwargs
               ):

    # Init the base class
    TP.__init__(self,
               numberOfCols = numberOfCols,
               cellsPerColumn = 1,
               burnIn = burnIn,
               collectStats = collectStats,
               seed = seed,
               verbosity = verbosity)

    self.predictionMethod = predictionMethod

    #---------------------------------------------------------------------------------
    # Create basic data structures for keeping track of column statistics

    # Number of times each column has been active during learning
    self.columnCount = numpy.zeros(numberOfCols, dtype="int32")

    # Running average of input density
    self.averageDensity = 0.05
Ejemplo n.º 2
0
    def __init__(
            self,
            numberOfCols=500,
            burnIn=2,  # Used for evaluating the prediction score
            collectStats=False,  # If true, collect training and inference stats
            seed=42,
            verbosity=VERBOSITY,
            predictionMethod='random',  # "random" or "zeroth"
            **kwargs):

        # Init the base class
        TP.__init__(self,
                    numberOfCols=numberOfCols,
                    cellsPerColumn=1,
                    burnIn=burnIn,
                    collectStats=collectStats,
                    seed=seed,
                    verbosity=verbosity)

        self.predictionMethod = predictionMethod

        #---------------------------------------------------------------------------------
        # Create basic data structures for keeping track of column statistics

        # Number of times each column has been active during learning
        self.columnCount = numpy.zeros(numberOfCols, dtype="int32")

        # Running average of input density
        self.averageDensity = 0.05
Ejemplo n.º 3
0
    def __init__(
        self,
        numberOfCols=500,
        cellsPerColumn=10,
        initialPerm=0.11,  # TODO: check perm numbers with Ron
        connectedPerm=0.50,
        minThreshold=8,
        newSynapseCount=15,
        permanenceInc=0.10,
        permanenceDec=0.10,
        permanenceMax=1.0,  # never exceed this value
        globalDecay=0.10,
        activationThreshold=12,  # 3/4 of newSynapseCount TODO make fraction
        doPooling=False,  # allows to turn off pooling
        segUpdateValidDuration=5,
        burnIn=2,  # Used for evaluating the prediction score
        collectStats=False,  # If true, collect training and inference stats
        seed=42,
        verbosity=VERBOSITY,
        checkSynapseConsistency=False,

        # List (as string) of trivial predictions to compute alongside
        # the full TP. See TrivialPredictor.py for a list of allowed methods
        trivialPredictionMethods='',
        pamLength=1,
        maxInfBacktrack=10,
        maxLrnBacktrack=5,
        maxAge=100000,
        maxSeqLength=32,

        # Fixed size mode params
        maxSegmentsPerCell=-1,
        maxSynapsesPerSegment=-1,

        # Output control
        outputType='normal',
    ):

        #---------------------------------------------------------------------------------
        # Save our __init__ args for debugging
        self._initArgsDict = _extractCallingMethodArgs()

        #---------------------------------------------------------------------------------
        # These two variables are for testing

        # If set to True, Cells4 will perform (time consuming) invariance checks
        self.checkSynapseConsistency = checkSynapseConsistency

        # If set to False, Cells4 will *not* be treated as an ephemeral member
        # and full TP10X pickling is possible. This is useful for testing
        # pickle/unpickle without saving Cells4 to an external file
        self.makeCells4Ephemeral = True

        #---------------------------------------------------------------------------------
        # Init the base class
        TP.__init__(
            self,
            numberOfCols=numberOfCols,
            cellsPerColumn=cellsPerColumn,
            initialPerm=initialPerm,
            connectedPerm=connectedPerm,
            minThreshold=minThreshold,
            newSynapseCount=newSynapseCount,
            permanenceInc=permanenceInc,
            permanenceDec=permanenceDec,
            permanenceMax=permanenceMax,  # never exceed this value
            globalDecay=globalDecay,
            activationThreshold=activationThreshold,
            doPooling=doPooling,
            segUpdateValidDuration=segUpdateValidDuration,
            burnIn=burnIn,
            collectStats=collectStats,
            seed=seed,
            verbosity=verbosity,
            trivialPredictionMethods=trivialPredictionMethods,
            pamLength=pamLength,
            maxInfBacktrack=maxInfBacktrack,
            maxLrnBacktrack=maxLrnBacktrack,
            maxAge=maxAge,
            maxSeqLength=maxSeqLength,
            maxSegmentsPerCell=maxSegmentsPerCell,
            maxSynapsesPerSegment=maxSynapsesPerSegment,
            outputType=outputType,
        )
Ejemplo n.º 4
0
  def __init__(self,
               numberOfCols = 500,
               cellsPerColumn = 10,
               initialPerm = 0.11, # TODO: check perm numbers with Ron
               connectedPerm = 0.50,
               minThreshold = 8,
               newSynapseCount = 15,
               permanenceInc = 0.10,
               permanenceDec = 0.10,
               permanenceMax = 1.0, # never exceed this value
               globalDecay = 0.10,
               activationThreshold = 12, # 3/4 of newSynapseCount TODO make fraction
               doPooling = False, # allows to turn off pooling
               segUpdateValidDuration = 5,
               burnIn = 2,             # Used for evaluating the prediction score
               collectStats = False,    # If true, collect training and inference stats
               seed = 42,
               verbosity = VERBOSITY,
               checkSynapseConsistency = False,

               # List (as string) of trivial predictions to compute alongside
               # the full TP. See TrivialPredictor.py for a list of allowed methods
               trivialPredictionMethods = '',
               pamLength = 1,
               maxInfBacktrack = 10,
               maxLrnBacktrack = 5,
               maxAge = 100000,
               maxSeqLength = 32,

               # Fixed size mode params
               maxSegmentsPerCell = -1,
               maxSynapsesPerSegment = -1,

               # Output control
               outputType = 'normal',
               ):

    #---------------------------------------------------------------------------------
    # Save our __init__ args for debugging
    self._initArgsDict = _extractCallingMethodArgs()

    #---------------------------------------------------------------------------------
    # These two variables are for testing

    # If set to True, Cells4 will perform (time consuming) invariance checks
    self.checkSynapseConsistency = checkSynapseConsistency

    # If set to False, Cells4 will *not* be treated as an ephemeral member
    # and full TP10X pickling is possible. This is useful for testing
    # pickle/unpickle without saving Cells4 to an external file
    self.makeCells4Ephemeral = True

    #---------------------------------------------------------------------------------
    # Init the base class
    TP.__init__(self,
               numberOfCols = numberOfCols,
               cellsPerColumn = cellsPerColumn,
               initialPerm = initialPerm,
               connectedPerm = connectedPerm,
               minThreshold = minThreshold,
               newSynapseCount = newSynapseCount,
               permanenceInc = permanenceInc,
               permanenceDec = permanenceDec,
               permanenceMax = permanenceMax, # never exceed this value
               globalDecay = globalDecay,
               activationThreshold = activationThreshold,
               doPooling = doPooling,
               segUpdateValidDuration = segUpdateValidDuration,
               burnIn = burnIn,
               collectStats = collectStats,
               seed = seed,
               verbosity = verbosity,
               trivialPredictionMethods = trivialPredictionMethods,
               pamLength = pamLength,
               maxInfBacktrack = maxInfBacktrack,
               maxLrnBacktrack = maxLrnBacktrack,
               maxAge = maxAge,
               maxSeqLength = maxSeqLength,
               maxSegmentsPerCell = maxSegmentsPerCell,
               maxSynapsesPerSegment = maxSynapsesPerSegment,
               outputType = outputType,
               )