Can I save and restore models?
Yes. The OPF Model object has methods for saving and loading models to/from disk:
The ModelFactory also has a loadFromCheckpoint function.
Can I disable learning?
Yes, with the Model.disableLearning. When learning is disabled, the model's representation of the data is not changed as it sees new patterns. You can enable learning with Model.enableLearning.
Are there any CLA visualization tools?
Swarming runs for long time and does not complete
This happens when the iteration count parameter in the swarm description is not set.
- Look for the swarm_description.py file.
- Look for the parameter "iterationCount": -1,
- Change this to "iterationCount": 1000,
- re-run the swarm
How do I extract details about the HTM's internal cellular state?
The following answer comes from the mailing list.
For example, in the examples/opf/clients/hotgym/simple example, after running the CLA with the inputs, you might like to extract these parameters from the model:
- Connections between bits of the input vector and columns
- Connections between cell outputs and segments
- Number of segments on a cell
- Segment thresholds
If you are using the OPF, then you're using using the
CLAModel, which is an OPF wrapper around a
Network instance. A
Network has a set of
Regions that are linked together and each
Region is a single algorithm component (like encoders, a spatial pooler, or a temporal memory instance). To get the data you are interested in, the first step is to extract the algorithm instances from the network, specifically the temporal memory (called TP in the code) and the spatial pooler. Here is a sample:
# Extract the spatial pooler
spRegion = model._getSPRegion()
# Extract the temporal memory
tmRegion = model._getTPRegion()
tm = tmRegion.getSelf()._tfdr
# Get the active cells
Spatial Pooler - for connections between columns and inputs.
From here, you can look at the implementations of the algorithms to see how to get each of the pieces of information that you need. The spatial pooler is a Python wrapper around a C++ class. The implementation is in
nupic.core/blob/master/src/nupic/algorithms/SpatialPooler.hpp and the wrapper code is in
Alternatively, you can change the model parameters in examples/opf/clients/hotgym/simple/model_params.py#L99 to set spatialImp to "py", which will use this pure-Python implementation.
Temporal Memory - for connections between cells, active cells, predicted cells, anomaly score.
The example mentioned is using a hybrid Python/C++ temporal memory implementation. The Python class is called
TP10X2 and some of the state is stored in a C++ class called
A good example to look at is this file in the Cerebro 2 project that extracts a bunch of relevant information from the Spatial Pooler and Temporal Memory:
How far ahead can a NuPIC model predict?
It can predict as many steps ahead as you like, but keep in mind that the more steps ahead, the less performant the model will become.
How many steps ahead can a model predict at one time?
As many as you like with multi-step predictions. Steps can be specified as an array of integers within model parameters.
Can an anomaly model also return predictions?
Yes, an anomaly model returns predictions. But non-anomaly models cannot return anomalies.
How many input fields can I pass into one model?
Theoretically, as many as you want, but realistically, not many. The performance suffers exponentially with every new field introduced into the mix if they are encoded and processed as potentially affecting the predicted field.
We generally discourage people from using more than a few fields per model.
What are the best model params for scalar anomaly detection?
Answer on HTM Forum.