[need help] how to improve non-linear result of svmtrain with grid search
1 次查看(过去 30 天)
显示 更早的评论
hello everyone, i have a problem with the result of svmtrain function on matlab and i would like to improve the result with grid search. My code is as follows :
clc;
clear;
close all;
%load data
data = load('database.mat','data');
data_train = (data.data(1:355,:));
data_test = (data.data(356:442,:));
%load class
class = 'E:\target.xlsx';
%taking the matrix
train_class = xlsread(class,'A1:A355');
test_class = xlsread(class,'A356:A442');
%crossvalidation SVM
cvFolds = crossvalind('kFold',train_class,70);
cp = classperf(train_class);
for i = 1:70
testIdx = (cvFolds == i);
trainIdx = ~testIdx;
model= svmtrain(data_train(trainIdx,:),train_class(trainIdx),...
'kernelcachelimit',100000,'kernel_function','polynomial','polyorder',4);
end
class_predict = svmclassify(model,data_test);
c = confusionmat(test_class, class_predict);
acc = sum(diag(c))/sum(c(:)); %accuracy
the accuracy is still below 90 percent so i want to improve it more by using grid search, to get the most optimum accuracy..do you know how to do that? or is there a better method than grid search? thx before..
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Direct Search 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!