This page show methods to save model using either pickle
:
>>> import pickle
>>> s = pickle.dumps(clf)
>>> clf2 = pickle.loads(s)
or joblib
:
>>> from sklearn.externals import joblib
>>> joblib.dump(clf, 'filename.joblib')
>>> clf = joblib.load('filename.joblib')
What if one needs to save 2 models? I can obviously save them in 2 separate files but can I save them together in one file? Is it possible to save a list which has 2 models:
modlist = [clf1, clf2]
How can this modlist
be saved in one file?