How to use globalDecay & maxAge

I’m trying to set globalDecay and maxAge to a value greater than zero in a TMRegion. But I keep getting an AssertionError.

I looked at these docs, and they say that maxSynapsesPerSegment and maxSegmentsPerCell must be set to -1 to disable fixed-sized CLA mode, but setting those two parameters don’t seem to correct the problem.

Does anyone know how to set globalDecay and maxAge to values greater than zero?

Here are the parameters and the call-stack:

tmParams:
    verbosity: 0
    columnCount: 2048
    cellsPerColumn: 32
    inputWidth: 2048
    seed: 1960
    temporalImp: cpp
    newSynapseCount: 20
    initialPerm: 0.21
    permanenceInc: 0.1
    permanenceDec: 0.15
    maxAge: 10
    globalDecay: 0.1
    maxSynapsesPerSegment: -1
    maxSegmentsPerCell: -1
    minThreshold: 12
    activationThreshold: 16
    outputType: normal
    pamLength: 1
    burnIn: 2
    maxInfBacktrack: 20
    maxLrnBacktrack: 10
    permanenceMax: 1.5
Traceback (most recent call last):
  File "./nunetwork.py", line 655, in <module>
    fq_results_filename=FQ_RESULTS_FILENAME)
  File "./nunetwork.py", line 487, in run_the_predictor
    network = createNetwork(dataSource=dataSource, fq_model_filename=fq_model_filename)
  File "./nunetwork.py", line 391, in createNetwork
    network.initialize()
  File "/opt/python_envs/nupic/local/lib/python2.7/site-packages/nupic/engine/__init__.py", line 697, in initialize
    engine_internal.Network.initialize(self, *args, **kwargs)
  File "/opt/python_envs/nupic/local/lib/python2.7/site-packages/nupic/bindings/engine_internal.py", line 1210, in initialize
    return _engine_internal.Network_initialize(self)
  File "/opt/python_envs/nupic/local/lib/python2.7/site-packages/nupic/regions/tm_region.py", line 425, in initialize
    **autoArgs)
  File "/opt/python_envs/nupic/local/lib/python2.7/site-packages/nupic/algorithms/backtracking_tm_cpp.py", line 162, in __init__
    outputType = outputType,
  File "/opt/python_envs/nupic/local/lib/python2.7/site-packages/nupic/algorithms/backtracking_tm.py", line 214, in __init__
    assert (globalDecay == 0.0)
AssertionError

Solution Found

I just did some debugging into the nupic library, and discovered in backtracking_tm_cpp.py on line 109, default values for maxSegmentsPerCell and maxSynapsesPerSegment are set to -1.

Additionally, when debugging I see the value of both maxSegmentsPerCell and maxSynapsesPerSegment are 4294967295 which is the maximum value for an unsigned int in C. It seems like there might be a problem with the C bindings converting the values input into the model params file, model.yaml, into an unsigned int, but should be converting it to a signed int.

At any rate, commenting out the following two lines from models.yaml solves the issue:

maxSynapsesPerSegment: -1
maxSegmentsPerCell: -1
1 Like

@mellertson It would be great if you reported this issue on github.

Good to know, and will do.

1 Like

FYI, I created issue # 3837 on Github.

1 Like