“one-against-one” approach

from sklearn import svm
X = [[0], [1], [2], [3]]
Y = [0, 1, 2, 3]
#“one-against-one” approach
clf = svm.SVC(decision_function_shape='ovo')
clf.fit(X, Y) dec = clf.decision_function([[1]])
print dec.shape[1] # 4 classes: 4*3/2 = 6
print clf.predict([[1]])

“one-vs-the-rest” multi-class strategy

from sklearn import svm
# “one-vs-the-rest” multi-class strategy
clf.decision_function_shape = "ovr"
dec = clf.decision_function([[1]])
dec.shape[1] # 4 classes
print dec.shape[1]
print clf.predict([[2.8]])

最新文章

  1. 基于 SailingEase WinForm Framework 开发优秀的客户端应用程序(目录)
  2. Ackerman函数的栈实现
  3. 0729pm命名空间
  4. NDK编译生成so文件
  5. EasyUI--初学
  6. Zookeeper相关知识
  7. unity android 集成指南
  8. jQuery技术内幕电子版5
  9. poj1463(树形dp)
  10. Node.js学习 - CallBack Function
  11. 内功心法 -- java.util.ArrayList<E> (6)
  12. [自制操作系统] JOS文件系统详解&支持工作路径&MSH
  13. angular 如何获取使用filter过滤后的ng-repeat的数据长度
  14. Redis info 参数详解
  15. vue中钩子函数的用法
  16. java实现:将一个数逆序输出
  17. ubuntu安装elasticsearch
  18. Appium环境搭建——安卓模拟器(AVD)调试 1-创建模拟器失败点的总结
  19. windows 解放鼠标快捷键
  20. Go调试工具—— Delve

热门文章

  1. js版的虚线框
  2. Android中IntentService与Service
  3. The inherit, initial, and unset values
  4. 读取 .properties文件到数据库
  5. linux如何设置磁盘配额?
  6. python高级 之(四) --- 模块方法
  7. 学习ansible笔记1
  8. SQL Injection(Blind)
  9. Python pip升级及升级失败解决方案
  10. 【机器学习】Learning to Rank入门小结 + 漫谈