Training and saving a model

Hello everyone,
I am trying to train CLA model on 1000 records and save the trained model. Can anyone share the example source code of training and saving a model. I want to do the prediction based on the saved model. I have thought of enable learning for the 30% of the data and do the prediction on remaining 70% if the data is not streaming.

Thanks in anticipation.

1 Like

Here is a simple example of feeding data from a CSV file into a model.

There are no training vs testing phases for HTM because it’s an online learning system. I suggest you leave learning on all the time for prediction. That way it can continue to adjust to the live data as it learns.

For details on how to save/load models, see our FAQ.

1 Like

Hi @rhyolight ,
Thanks for the reply.

I have gone through that example but i am not able to understand that where are we doing the training there.
Does the model get updated when we call . Where should i use the in order to save the trained model and doing the offline prediction. Please clarify me.

Yes, it learns on each iteration unless you call disableLearning().

You can save anytime.

I don’t understand the question. You do not have to save a model unless you want to shut down the program and start it up again later with the same model state. Saving / loading a model does not affect its learning state.

@rhyolight Thanks again.

My issue got resolved. I was having problem in saving the trained model. i am able to save the model now.