I have trained a RandomForestClassifier from Python Sckit Learn Module with very big dataset, but question is how can I possibly save this model and let other people apply it on their end.Thank you!
- Seescikit-learn.org/stable/tutorial/basic/…EdChum– EdChum2014-04-11 13:07:54 +00:00CommentedApr 11, 2014 at 13:07
2 Answers2
The recommended method is to usejoblib, this will result in a much smaller file than a pickle:
from sklearn.externals import joblibjoblib.dump(clf, 'filename.pkl') #then your colleagues can load itclf = joblib.load('filename.pkl')See theonline docs
Comments
Have you tried pickling theRandomForestClassifier using the Pickle module and then saving it to the disk?
Here’s an example based on thepickle docs:
import pickleclassifier = RandomForestClassifier(etc)output = open('classifier.pkl', 'wb')pickle.dump(classifier, output)output.close()The “other people” could then reload the pickled object as follows:
import picklef = open('classifier.pkl', 'rb')classifier = pickle.load(f)f.close()1 Comment
Explore related questions
See similar questions with these tags.
