Feeding TM output back to SP manually

I have 12 fields resulting in a 20,225-bit encoding. If I use TM (from research) alone and give it 20,225 columns, it learns, predicts, and decodes to correct values (since the encoder.topDownCompute() results in active columns isomorphic with the originally-encoded SDRs).

I can also use SP (from research) in the same stand-alone fashion with good results.

But if I want to put the 20,225-bit encoded array into the SP and sp.compute(), it will output active columns (of length 2048, say). The TM can be set to 2048 columns and can receive the SP’s output. How do I then take the TM’s 2048-bit prediction of active columns for the next time step and feed them back to the SP? The sp.compute() method wants 20,225, not 2048. What other method do I call? And if I can feed the predicted columns from TM to SP, how do I use that within the SP to generate the full encoding that the MultiEncoder can decode?

I believe this is what the Network API does, but A) I can’t get good results from modifying the network example, and B) I want to use the latest (research) versions of SP and TM.

Thanks for any assistance.

2 Likes

Hi @Containerhouse,

The typical sequence of data fed through the algorithms is:

Data > Encoder > Spatial Pooler > Temporal Memory > SDRClassifier or Anomaly-Likelihood, depending on if you’re doing predictive processing or anomaly processing.

I’m not sure why you’d want to feed the data back into the Spatial Pooler from the Temporal Memory, The algorithms don’t require that in order to function properly?

1 Like

Thanks, @cogmission! Perhaps the SDRClassifier is what I am missing. Since the SP gives TM its column numbers, I thought I had to refer back to the SP with TM predictions.

Ah that just shows you really did understand what was happening, just not how it was getting accomplished within the code! Kudos! :wink:

1 Like

Ah, yes. I recognize the patternNZ parameter for the SDRClassifier as an output from the lower levels I see printed in the terminal with verbosity turned up.

1 Like

Right, so you can query the Classifier to get the most “probable” predicted field, and then since it stores the original output for the field, you can get the input from it also. (at least that’s how the CLAClassifier worked, I’m not exactly sure about the newer SDRClassifier, but I’d be surprised if that basic functionality weren’t preserved in the new classifier).

1 Like