【发布时间】:2016-12-20 19:28:15
【问题描述】:
我正在寻找 C(成本参数)的最佳值来训练我的 SVM 分类器。这是我的代码:
clear all; close all; clc
% Load training features and labels
[y, x] = libsvmread('training_data.train'); %the training dataset is named training_data.train
cost=[2^-7,2^-5,2^-3,2^-1,2^1,2^3,2^5,2^7,2^9,2^11,2^13,2^15];
accuracy=zeros(1,length(cost)); %This array will store the accuracy values corresponding to each element in the cost array
for i = 1:length(cost)
opt = sprintf('-c %i -v 3',cost(i));
accuracy(i)=svmtrain(y,x,opt);
end
accuracy
我正在使用 LIBSVM 库。当我运行这个程序时,准确度数组中填充了非常奇怪的值: 这是输出:
第 1 至 8 列:
67.335 93.696 91.404 92.550 93.696 93.553 93.553 93.553
第 9 到 12 列:
93.553 93.553 93.553 93.553
这意味着我在 2^-5 上获得了最高的交叉验证准确度。我应该在 C 的最高值上获得最高精度吗? (据我所知,这是错误分类的惩罚因素)。这是预期的行为吗? (我正在使用 UCI ML 数据库构建一个用于乳腺癌识别的分类器)。
【问题讨论】:
标签: machine-learning svm