Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to output sklearn standardscaler

I have standardized my data in sklearn using preprocessing.standardscaler. Question is how could I save this in my local for latter use?

Thanks

like image 359
user3038725 Avatar asked Apr 21 '14 16:04

user3038725


1 Answers

If I understand you correctly you want to save your trained model so it can be loaded again correct?

There are two methods, using python's pickle and the other method which is to use joblib. The recommend method is joblib as this will result in a much smaller file than a pickle, which dumps a string representation of your object:

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

#then load it later, remember to import joblib of course

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

See the online docs

Note: sklearn.externals.joblib is deprecated. Install and use the pure joblib instead

like image 82
EdChum Avatar answered Oct 30 '22 07:10

EdChum