Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output RandomForest Classifier from python?

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!

like image 354
user3038725 Avatar asked Apr 10 '14 23:04

user3038725


1 Answers

The recommended method is to use joblib, this will result in a much smaller file than a pickle:

from sklearn.externals import joblib
joblib.dump(clf, 'filename.pkl') 

#then your colleagues can load it

clf = joblib.load('filename.pkl')

See the online docs

like image 88
EdChum Avatar answered Oct 18 '22 13:10

EdChum