I am using Nupic Algorithms API to implement the HTM. I want to know how I can save the learned HTM model so that the next time I start the program, HTM continues learning from that point instead of starting from scratch. Please note that I am using the Algorithms API and not the OPF or Network API to implement the HTM. Thank you.
Hello, see the docs for our new serialization.
3 posts were split to a new topic: KjException when serializing
I wonder if there is an example of using the new serialization, and also if there is an example of using HTM for online streaming anomaly detection.
It’s old but should still work: https://github.com/numenta/nupic/blob/master/examples/opf/clients/hotgym/anomaly/one_gym/README.md
thx for the quick answer. I wonder were I’m missing the right code for this.
so what I need is one of two:
- write a script which will run as a process, thus the model will be up always and will receive every defined amount of time new data, and run it into the model to decide if anomaly or not.
- script which will run on a data of a whole week ( for example ), save the model, and then I will have another script which will run every 2 min to check if the new received data is anomaly, of course using the saved model.
so the hot gym tutorial answers for one of these cases?
and if so should I look into “run.py” or “nupic_output.py”
if the tutorial is not matching these cases, should I look into serialization?
Im a lil bit confused here…
thx for the help:)
The hot gym example shows you how to do #1, sure. All you need to do is hold a model instance in memory and call
run() on it. That will update the model and get a new anomaly value. There is no example in there for saving, but if you don’t mind pickling you can use
model.save() (the old way).
FYI: The “new way” of serialization works too, but you have to get to the algorithm instances and save them differently (see above).
great! thank you very much
So i saw you mentioned that for online anomaly detection no swarming is needed, but how should I create a model without any parameters? what do I miss?
Thx in advance
Nupic models can’t be created without corresponding parameter configs. For anomaly detection there’s a specific function that a generates this config, so all anomaly detection config files are nearly the same (except for the field names and their min/max values).
The function is getScalarMetricWithTimeOfDayAnomalyParams(), in nupic.frameworks.opf.common_models.cluster_params