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