Can we get TM predictedCells from NuPIC ModelFactory models?

Anyone know if its possible to get the number of predicted TM cells out of a ModelFactory model?

I’m creating these on the fly and storing them in a dictionary as they’re continuously updated. This allows multivariate files to be streamed in and modeled field-by-field, with no prior exploration.

I know TM objects contain the predictedCells, though I’m not sure if I can extract the TM object from a ModelFactory model object.

Thanks as always!

  • model._getSPRegion().getSelf().getAlgorithmInstance() gets you the SP
  • model._getTPRegion().getSelf().getAlgorithmInstance() gets you the TM (bad naming I know)

There’s a partial example of this hidden in the serialization docs. It’s not an official API, obviously.

1 Like

I got these attributes when looking into this object, it seems to have a lot of stuff though not the getPredictiveCells() function exactly.

Seems its actually a BacktrackingTM.cpp object:

type(myTM)
<class 'nupic.algorithms.backtracking_tm_cpp.BacktrackingTMCPP'>

I think I’ve actually got it here :sweat_smile:

getPredictedState()
:returns: numpy array of predicted cells, representing the current predicted
  state. ``predictedCells[c][i]`` represents the state of the i'th cell in 
  the c'th column.
1 Like