# View more python tutorials on my Youtube and Youku channel!!!

# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial """
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
"""
from __future__ import print_function
from sklearn import svm
from sklearn import datasets clf = svm.SVC()
iris = datasets.load_iris()
X, y = iris.data, iris.target
clf.fit(X, y) # method 1: pickle
import pickle
# save
with open('save/clf.pickle', 'wb') as f:
pickle.dump(clf, f)
# restore
with open('save/clf.pickle', 'rb') as f:
clf2 = pickle.load(f)
print(clf2.predict(X[0:1])) # method 2: joblib
from sklearn.externals import joblib
# Save
joblib.dump(clf, 'save/clf.pkl')
# restore
clf3 = joblib.load('save/clf.pkl')
print(clf3.predict(X[0:1]))

最新文章

  1. Webservice简介
  2. Multiplexing SDIO Devices Using MAX II or CoolRunner-II CPLD
  3. 读书笔记2014第3本:Visual Studio程序员箴言
  4. 关于css float 属性以及position:absolute 的区别。
  5. SunTlsRsaPremasterSecret KeyGenerator not available问题解决
  6. Thinkphp编辑器扩展类kindeditor用法
  7. ThreadLocal笔记
  8. Pick apples(大范围贪心,小范围完全背包)
  9. Linux 打开句柄限制的调整
  10. 从PRISM开始学WPF(六)MVVM(二)Command-更新至Prism7.1
  11. GUI学习之三——QObject学习总结
  12. SMBus与I2C的差别
  13. error::尝试加载 Oracle 客户端库时引发 BadImageFormatException。如果在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运行,将出现此问题。
  14. Java导出Excel表,POI 实现合并单元格以及列自适应宽度(转载)
  15. couldn't connect to host
  16. 草莓糖CMT依旧强势,数字货币量化分析[2018-05-29]
  17. HDFS集中式的缓存管理原理与代码剖析
  18. U盘拷贝大文件提示文件过大无法拷贝解决方案
  19. 重新认识synchronized(下)
  20. C/C++中qsort()以及sort()的用法

热门文章

  1. Java 获取PDF数字签名证书信息
  2. Financial Tsunami
  3. [cf700D]Huffman Coding on Segment
  4. 简单的MISC,writerup
  5. vagrant创建centos7后虚拟机磁盘爆满
  6. 【Tool】IDEA功能--SVN和Git
  7. 从零开始,使用Dapr简化微服务
  8. 快读模板 + #define 压缩for
  9. AT3945 [ARC092D] Two Faced Edges
  10. Codeforces 1010F - Tree(分治 NTT+树剖)