資源簡介
本程序有算例分析,詳細介紹了三種優化SVM方法:遺傳算法、PSO、網格搜索法

代碼片段和文件信息
%%?SVM神經網絡中的參數優化---如何更好的提升分類器的性能?
%
%?
%? 該案例作者申明: 1:本人長期駐扎在此板塊里,對該案例提問,做到有問必答。 2:此案例有配套的教學視頻,配套的完整可運行Matlab程序。 3:以下內容為該案例的部分內容(約占該案例完整內容的1/10)。 4:此案例為原創案例,轉載請注明出處(Matlab中文論壇,《Matlab神經網絡30個案例分析》)。 5:若此案例碰巧與您的研究有關聯,我們歡迎您提意見,要求等,我們考慮后可以加在案例里。 6:您看到的以下內容為初稿,書籍的實際內容可能有少許出入,以書籍實際發行內容為準。 7:此書其他常見問題、預定方式等,請點擊這里。
%?
%
%%?清空環境變量
function?chapter13_GA
close?all;
clear;
clc;
format?compact;
%%?數據提取
%?載入測試數據wine其中包含的數據為classnumber?=?3wine:178*13的矩陣wine_labes:178*1的列向量
load?chapter13_wine.mat;
%?畫出測試數據的box可視化圖
figure;
boxplot(wine‘orientation‘‘horizontal‘‘labels‘categories);
title(‘wine數據的box可視化圖‘‘FontSize‘12);
xlabel(‘屬性值‘‘FontSize‘12);
grid?on;
%?畫出測試數據的分維可視化圖
figure
subplot(351);
hold?on
for?run?=?1:178
????plot(runwine_labels(run)‘*‘);
end
xlabel(‘樣本‘‘FontSize‘10);
ylabel(‘類別標簽‘‘FontSize‘10);
title(‘class‘‘FontSize‘10);
for?run?=?2:14
????subplot(35run);
????hold?on;
????str?=?[‘attrib?‘num2str(run-1)];
????for?i?=?1:178
????????plot(iwine(irun-1)‘*‘);
????end
????xlabel(‘樣本‘‘FontSize‘10);
????ylabel(‘屬性值‘‘FontSize‘10);
????title(str‘FontSize‘10);
end
%?選定訓練集和測試集
%?將第一類的1-30第二類的60-95第三類的131-153做為訓練集
train_wine?=?[wine(1:30:);wine(60:95:);wine(131:153:)];
%?相應的訓練集的標簽也要分離出來
train_wine_labels?=?[wine_labels(1:30);wine_labels(60:95);wine_labels(131:153)];
%?將第一類的31-59第二類的96-130第三類的154-178做為測試集
test_wine?=?[wine(31:59:);wine(96:130:);wine(154:178:)];
%?相應的測試集的標簽也要分離出來
test_wine_labels?=?[wine_labels(31:59);wine_labels(96:130);wine_labels(154:178)];
%%?數據預處理
%?數據預處理將訓練集和測試集歸一化到[01]區間
[mtrainntrain]?=?size(train_wine);
[mtestntest]?=?size(test_wine);
dataset?=?[train_wine;test_wine];
%?mapminmax為MATLAB自帶的歸一化函數
[dataset_scaleps]?=?mapminmax(dataset‘01);
dataset_scale?=?dataset_scale‘;
train_wine?=?dataset_scale(1:mtrain:);
test_wine?=?dataset_scale(?(mtrain+1):(mtrain+mtest):?);
%%?選擇GA最佳的SVM參數c&g
%?GA的參數選項初始化
ga_option.maxgen?=?200;
ga_option.sizepop?=?20;?
ga_option.cbound?=
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-02-28?11:09??SVM參數優化\
?????文件????????8171??2010-01-30?19:26??SVM參數優化\chapter13_GA.m
?????文件????????7762??2010-01-30?18:48??SVM參數優化\chapter13_GridSearch.m
?????文件???????10174??2010-01-30?19:30??SVM參數優化\chapter13_PSO.m
?????文件???????20168??2010-01-30?18:38??SVM參數優化\chapter13_wine.mat
?????目錄???????????0??2014-02-28?11:09??SVM參數優化\html\
?????文件???????28493??2009-11-04?21:15??SVM參數優化\html\chapter13.html
?????文件????????3348??2009-11-04?21:15??SVM參數優化\html\chapter13.png
?????文件????????6809??2009-11-04?21:15??SVM參數優化\html\chapter13_01.png
?????文件???????10845??2009-11-04?21:15??SVM參數優化\html\chapter13_02.png
?????文件???????11480??2009-11-04?21:15??SVM參數優化\html\chapter13_03.png
?????文件???????14158??2009-11-04?21:15??SVM參數優化\html\chapter13_04.png
?????文件???????18174??2009-11-04?21:15??SVM參數優化\html\chapter13_05.png
?????文件???????15252??2009-11-04?21:15??SVM參數優化\html\chapter13_06.png
?????文件????????9026??2009-11-04?21:15??SVM參數優化\html\chapter13_07.png
?????文件???????27311??2010-01-30?19:28??SVM參數優化\html\chapter13_GA.html
?????文件????????3294??2010-01-30?19:28??SVM參數優化\html\chapter13_GA.png
?????文件????????6809??2010-01-30?19:28??SVM參數優化\html\chapter13_GA_01.png
?????文件???????10845??2010-01-30?19:28??SVM參數優化\html\chapter13_GA_02.png
?????文件???????13253??2010-01-30?19:28??SVM參數優化\html\chapter13_GA_03.png
?????文件????????9059??2010-01-30?19:28??SVM參數優化\html\chapter13_GA_04.png
?????文件???????26840??2010-01-30?18:57??SVM參數優化\html\chapter13_GridSearch.html
?????文件????????3348??2010-01-30?18:57??SVM參數優化\html\chapter13_GridSearch.png
?????文件????????6809??2010-01-30?18:56??SVM參數優化\html\chapter13_GridSearch_01.png
?????文件???????10845??2010-01-30?18:56??SVM參數優化\html\chapter13_GridSearch_02.png
?????文件???????12629??2010-01-30?18:56??SVM參數優化\html\chapter13_GridSearch_03.png
?????文件?????????899??2010-01-30?18:56??SVM參數優化\html\chapter13_GridSearch_04.png
?????文件???????22250??2010-01-30?18:56??SVM參數優化\html\chapter13_GridSearch_05.png
?????文件???????15799??2010-01-30?18:56??SVM參數優化\html\chapter13_GridSearch_06.png
?????文件????????9026??2010-01-30?18:57??SVM參數優化\html\chapter13_GridSearch_07.png
?????文件???????34244??2010-01-30?19:33??SVM參數優化\html\chapter13_PSO.html
............此處省略5個文件信息
評論
共有 條評論