I am performing a cross validation (I know this is not was HTM is made for…but we have to compare performances…so what to do )
So I have 7 trainings and test sets.
After finishing my training for one model, I save it into a list.
When I trained all models I pickle the list with a simple expression:
with open("model.pkl", "w") as f:
where models is the list containing all my models.
All that works fine. (even saving the models in a list and using just one of them afterwards is working).
Now my problem (for which i was not able to find a solution here in the forum even with hours of reading )
I load the models from the pickle again with:
with open("model.pkl") as f:
reloaded_models = pickle.load(f)
when I now want to make a prediction I get the following error:
assert not self.__restoringFromState
How can I fix this bug?
I really need my models in pickle… soo any help would be really appreciated.
unfortunately no… I read both before even opening this new topic… but they doen’t help me.
The thing is:
I calculate the models.
I can work with all the results and to prediction and everything. But as soon as I pickle and reload them i get this error…
I also checked the code in nupic/frameworks/opf/htm_prediction_model.py … I tried to manually set the __restoringFromState variable. But even this does not work…
Did you try the new way of saving using writeToFile and readFromFile? If you can’t just put models in a list and pickle them, you’ll need to keep track of the sp and tm files separately for each model.