Hello,
I have a sequence s = [0, 0, 4, 7, 8, 4, 6, 8, 8, 9, 9, 5, 2, 1, 5, 3, 1, 1, 0, 0, 4, 7, 8, 4, 6, 8, 8, 9, 9, 5, 2, 1, 5, 3, 1, 1, 0, 0, 4, 7, 8, 4, 6, 8, 8, 9, 9, 5, 2, 1, 5, 3, 1, 1, 0, 0, 4, 7, 8, 4, 6, 8, 8, 9, 9, 5, 2, 1, 5, 3, 1, 1, 0, 0, 4, 7, 8, 4, 6, 8, 8, 9, 9, 5, 2, 1, 5, 3, 1, 1, 0, 0, 4, 7, 8, 4, 6, 8, 8]
. I encoded it using the htm.core rdse encoder
params = RDSE_Parameters()
params.activeBits = 3
params.radius = 5
params.size = 10
rdseEncoder = RDSE(params)
I am using the hotgym.py example to train SP/TM architecture and predict next step (I’m actually only using about 80% of the elements in s so I can check how accurate predictions are to the truth). Here is what I have for SP and TM set-up
sp = SP(inputDimensions = (rdseEncoder.size,),
columnDimensions = (50,),
localAreaDensity = 0.02,
globalInhibition = True,
synPermActiveInc = 0.01,
synPermInactiveDec = 0.008
)
tm = TM(columnDimensions = (50,),
cellsPerColumn=10,
initialPermanence=0.1,
connectedPermanence=0.2,
minThreshold=1,
maxNewSynapseCount=40,
permanenceIncrement=0.15,
permanenceDecrement=0.1,
activationThreshold=3,
predictedSegmentDecrement=0.01,
maxSegmentsPerCell = 1,
maxSynapsesPerSegment = 1
)
and to train the model I have
predictor = Predictor([1,2])
for epoch in range(10):
# if run without the reset, eventually get the following error
# RuntimeError: Exception: SDRClassifier.cpp(228)
# message: CHECK FAILED: "recordNum >= lastRecordNum"
# The record number must increase monotonically.
predictor.reset()
for count, elem in enumerate(train_set):
rdseSDR = rdseEncoder.encode(elem)
activeColumns = SDR( dimensions = tm.getColumnDimensions() )
sp.compute(rdseSDR, True, activeColumns)
tm.compute(activeColumns, learn=True)
tm_actCells = tm.getActiveCells()
predictor.learn(count, tm_actCells, int(elem) )
However, when I print active cells, winner cells, and predictive cells for each iteration, predictive cells always come out as all 0’s. I have attempted to modify the parameters for the spatial pooling and temporal memory architecture, but it doesn’t seem to have much of an effect on the predictions. While I expect some wrong predictions at first, I do not expect just 0’s every time.
I would appreciate it greatly if someone points out the issue in my code that’s causing this. Or, maybe explain what could be causing the issue and why? I am new to implementing the HTM to data not already in example code.