如何使用libsvm实现一对一多类分类?请帮我解决这个问题.
我还从这个答案中读到了一对一的方法...... 使用Matlab进行交叉验证的多类SVM的完整示例[关闭]
我的测试数据:功能和最后一列是标签
D = [
1 1 1 1 1
1 1 1 9 1
1 1 1 1 1
11 11 11 11 2
11 11 11 11 2
11 11 11 11 2
30 30 30 30 3
30 30 30 30 3
30 30 30 30 3
60 60 60 60 4
60 60 60 60 4
60 60 60 60 4
];
Run Code Online (Sandbox Code Playgroud)
我的测试数据是
inputTest = [
1 1 1 1
11 11 11 10
29 29 29 30
60 60 60 60
];
Run Code Online (Sandbox Code Playgroud)
LIBSVM提供了一个Matlab接口.在包中,有一个很好README的如何通过Matlab使用这个接口.
用法是:
matlab> model = svmtrain(training_label_vector, training_instance_matrix [, 'libsvm_options']);
Run Code Online (Sandbox Code Playgroud)
使用以下参数:
-training_label_vector:
An m by 1 vector of training labels (type must be double).
-training_instance_matrix:
An m by n matrix of m training instances with n features.
It can be dense or sparse (type must be double).
-libsvm_options:
A string of training options in the same format as that of LIBSVM.
Run Code Online (Sandbox Code Playgroud)
但是,由12个示例组成的训练数据不足以构建良好的SVM分类器.您应该获得更多培训和测试过程的示例.