sklearn 儲存訓練後的模型 - SeanWu1977/Machine-Learning GitHub Wiki


from sklearn.externals import joblib
from sklearn.linear_model import Perceptron

ppn = Perceptron(max_iter=40, eta0=0.01, random_state=0)
ppn.fit(X_train_std, y_train)

filename = 'ppn_model.sav'
joblib.dump(ppn, filename)
ppn_load = joblib.load(filename)