Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model saving and loading #6

Closed
sethjuarez opened this issue Apr 9, 2013 · 9 comments
Closed

Model saving and loading #6

sethjuarez opened this issue Apr 9, 2013 · 9 comments

Comments

@sethjuarez
Copy link
Owner

Add ability to save and load models

@ghost ghost assigned sethjuarez Apr 9, 2013
@civ101
Copy link

civ101 commented Dec 4, 2013

Any idea when the saving and loading a model will be complete? I have been able to save the model to file, but upon loading the file is when the model does not understand my programs classes. Otherwise this NuGet package has help save much time.

@sethjuarez
Copy link
Owner Author

I will work on it today and next week - sorry for the delay! I have been out of town a whole bunch. Would love some help!

@TonyHenrique
Copy link

Your Library is looking awesome, I hope you complete it and the examples and documentation too, in the same style of that Tennis example, for Supervised Learning and Unsupervised learning

@sethjuarez
Copy link
Owner Author

I added serialization to all of the supervised models (and tests for DT's and NaiveBayes). I also added helper methods on the base Model class to simplify adding serialization to models in the future.

@DashNY
Copy link

DashNY commented Jan 8, 2015

I was able to save a model into a file but I can't seem to figure out how to load it next time application starts.

SAVE:
learningModel = Learner.Learn(data, .80, 1000, generator);
learningModel.Model.Save(modelFileName);

LOAD: (not working, throwing NullRefException)
learningModel = new LearningModel();
learningModel.Model.Load(modelFileName);

@PippoAe
Copy link

PippoAe commented Sep 15, 2017

I'm stuck on the same.
Saving works fine, but I don't know how to load it.

@rold2007
Copy link

@PippoAe I saw that recently @sethjuarez committed some code to better support serialization for NaiveBayes. Have you tried with the latest version ? Which generator did you use ? Have you seen this issue, it seems that after loading a model you still need to initialize the Descriptor.
If that doesn't solve your issue I would suggest you to open a new issue, including some code and steps to reproduce your issue.

@PippoAe
Copy link

PippoAe commented Sep 16, 2017

Hi rold!
Thanks for the fast answer.
I now worked around the error.

I'm still using "model.Save(modelPath);" to save the TreeDecisionModel the learner has after learning.

To load I now use:
DecisionTreeModel model = (DecisionTreeModel)numl.Utils.Xml.Load(modelpath, typeof(DecisionTreeModel));

This returns me a working model again that I can use .Predict() on.

@sethjuarez
Copy link
Owner Author

Yay!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants