Pregunta

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

Thanks

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top