模型的dump与load

1. sklearn 参照: http://scikit-learn.org/stable/tutorial/basic/tutorial.html

from sklearn.externals import joblib
joblib.dump(clf, 'filename.pkl') 
clf = joblib.load('filename.pkl') 

以上适合所有sklearn相关的模型,如scaler模型,imputer,以及分类器模型等等。


2. xgboost 参照: http://blog.csdn.net/zc02051126/article/details/46771793

# dump model

bst.dump_model('dump.raw.txt')

# dump model with feature map

bst.dump_model('dump.raw.txt','featmap.txt')

#init model

bst = xgb.Booster({'nthread':4})

#load data

bst.load_model("model.bin")

你可能感兴趣的:(sk-learn)