Easy way of getting predictive cells from a network model?

Hi again,

Currently working on a network model that looks like this

Sensor -> SP -> TM -> next prediction from TM

However, I’m currently having major issue getting the output from the temporal memory. When I’m only working with the temporal memory object (not in a network structure) I can just call on the method getPredictiveCells() and get what I want. Any suggestions to do the same with a network model? I have tried “tm.getOutputData(“predictedActiveCells”)” but not really the same.

Cheers!

Have you tried tm.getSelf()? Inspect the object you get back and see if you can find the TM algorithm instance on it. Then you can call getPredictiveCells() on it.

Yeah, but I get into the problem of the region not having the attribute, i.e. AttributeError: ‘TMRegion’ object has no attribute ‘getPredictiveCells’. Tried to find the instance but by digging in the source code of tm_region.py and I found that (line 319-320)

Which Temporal implementation?

TemporalClass = _getTPClass(temporalImp)

you cannot access the TM instance. I guess a work around could be to change it to self.TemporalClass?

Try tmRegion.getAlgorithmInstance().getPredictiveCells()

1 Like

Worked like a charm! Thanks again Matt!