Back
You have to initialize your classifier first and then train it for a long time with
clf= some.classifier()
clf.fit(x,y)
After this you can opt for any of the two options-
1. Using Pickle
import picklewith open('file.pkl', 'wb') as f: pickle.dump(clf, f)with open('file.pkl', 'rb') as f: clf = pickle.load(f)
import pickle
with open('file.pkl', 'wb') as f:
pickle.dump(clf, f)
with open('file.pkl', 'rb') as f:
clf = pickle.load(f)
2. Using Joblib
from sklearn.externals import joblibjoblib.dump(clf, 'filename.pkl')clf = joblib.load('filename.pkl')
from sklearn.externals import joblib
joblib.dump(clf, 'filename.pkl')
clf = joblib.load('filename.pkl')
31k questions
32.8k answers
501 comments
693 users