How to save a learned HTM model?

#1

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. :slight_smile:

0 Likes

#2

Hello, see the docs for our new serialization.

0 Likes

split this topic #3

3 posts were split to a new topic: KjException when serializing

0 Likes

#4

Hi,

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.

Thanks

Arkady

0 Likes

#5

It’s old but should still work: https://github.com/numenta/nupic/blob/master/examples/opf/clients/hotgym/anomaly/one_gym/README.md

0 Likes

#6

thx for the quick answer. I wonder were I’m missing the right code for this.
so what I need is one of two:

  1. 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.
  2. 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:)

arkady

1 Like

#7

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).

1 Like

#8

great! thank you very much

0 Likes