Memory Allocation Error from Predictor


I am using Python 3 on Windows 10, and htm.core. I want to predict the 11-th term from the sequence train_set = [1, 8, 25, 83, 274, 2275, 132224, 1060067, 3312425, 10997342] (I am testing a hypothesis involving different types of sequences). The encoder I am using is

params = RDSE_Parameters()
params.sparsity = 0.05
params.radius = 1000
params.size = 1000
rdseEncoder = RDSE(params)

As I troubleshoot, I find that I’m not having issues with SP or TM. They are doing their thing well. In fact, I can run 10 epochs of the learning steps very fast (if the following is commented out). I am receiving a memory allocation error, however, from training the predictor

label = int(train_set[i])
predict.learn(count, tm_actCells, label)

during the first epoch when I get to element 3312425. I’ve used this code for other sequences, and the only thing that really changes from sequence to sequence are the labels (count is still 0 to length of training set). I wonder if the size of the integer is the issue? 3x10^6 is pretty large, and larger than any integer for the previous training sets. I’m interested in other people’s thoughts on this issue because it is curious.

Thank you!

1 Like

Hey @aklandi,

I don’t have the answer to your Memory Allocation error, but I do see an issue the sequence you’re trying to learn from.

This is a monotonically increasing sequence, so there’s no periodicity. For HTM (afaik) this is like seeing the sequence:
and trying to predict G.

Since HTM has never seen the F-->G transition, it won’t predict G from F. In order to predict G from F one must be familiar with the alphabet.

Likewise in your case, though there may be a pattern there (maybe one number is a certain multiple of the previous), HTM doesn’t understand this like it doesn’t know the alphabet. It a pure sequence learner, and since it’s never seen input 10997342, that input won’t generate any predictions.


Thanks! That’s what I figured too, but I just wanted to see what the algorithm might do since most examples demonstrate HTM performance when it does well. My work around the memory allocation error was to only input the first 6-7 elements during learning and then predict the 8th element. It is as you said, since it hasn’t seen the value, the prediction is poor (and definitely true since it doesn’t have very many elements to learn from).

1 Like