pickle save sklearn model code example
Example 1: pickle save
import pickle
pickle.dump( favorite_color, open( "save.p", "wb" ) )
favorite_color = pickle.load( open( "save.p", "rb" ) )
Example 2: sklearn save model
# save as object
import pickle
s = pickle.dumps(clf)
clf2 = pickle.loads(s)
# save to file
from joblib import dump
dump(clf, 'filename.joblib')
# load from file
from joblib import load
clf = load('filename.joblib')