資源簡介
進行SVM時運用高斯核,需要參數選擇,改程序用來參數選擇
代碼片段和文件信息
function?[bestaccbestcbestg]?=?SVMcgForClass(train_labeltraincmincmaxgmingmaxvcstepgstepaccstep)
%SVMcg?cross?validation?by?faruto
%
%?by?faruto
%Email:patrick.lee@foxmail.com?QQ:516667408?http://blog.sina.com.cn/faruto?BNU
%last?modified?2010.01.17
%%?若轉載請注明:
%?faruto?and?liyang??LIBSVM-farutoUltimateVersion?
%?a?toolbox?with?implements?for?support?vector?machines?based?on?libsvm?2009.?
%?
%?Chih-Chung?Chang?and?Chih-Jen?Lin?LIBSVM?:?a?library?for
%?support?vector?machines?2001.?Software?available?at
%?http://www.csie.ntu.edu.tw/~cjlin/libsvm
%%?about?the?parameters?of?SVMcg?
if?nargin?10
????accstep?=?4.5;
end
if?nargin?8
???cstep?=?0.8;
????gstep?=?0.8;
end
if?nargin?7
????v?=?5;
end
if?nargin?5
????gmax?=?8;
????gmin?=?-8;
end
if?nargin?3
????cmax?=?8;
????cmin?=?-8;
end
%%?X:c?Y:g?cg:CVaccuracy
[XY]?=?meshgrid(cmin:cstep:cmaxgmin:gstep:gmax);
[mn]?=?size(X);
cg?=?zeros(mn);
eps?=?10^(-4);
%%?record?acc?with?different?c?&?gand?find?the?bestacc?with?the?smallest?c
bestc?=?1;
bestg?=?0.1;
bestacc?=?0;
basenum?=?2;
for?i?=?1:m
????for?j?=?1:n
????????cmd?=?[‘-v?‘num2str(v)‘?-c?‘num2str(?basenum^X(ij)?)‘?-g?‘num2str(?basenum^Y(ij)?)];
????????cg(ij
- 上一篇:道路圖像分割程序
- 下一篇:寬帶信號DOA估計算法
評論
共有 條評論