python 保存训练好的模型
from sklearn.externals import joblib
A=[[1,2,3],[4,5,6],[7,8,9]]
B=A+A
print(B)
joblib.dump(B, 'saved_model/B.pkl') # 保存模型,需先建立saved_model文件夹
[[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 2, 3], [4, 5, 6], [7, 8, 9]]
[‘saved_model/B.pkl’]
from sklearn.externals import joblib
B = joblib.load('saved_model/B.pkl') # 下载模型
print(B)
[[1, 2, 3], [4, 5, 6], [7, 8, 9], [1, 2, 3], [4, 5, 6], [7, 8, 9]]