全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:4252
推到 Plurk!
推到 Facebook!

matlab-畫圖問題

尚未結案
dicky9055
一般會員


發表:20
回覆:48
積分:18
註冊:2006-08-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-05-27 22:41:43 IP:60.244.xxx.xxx 訂閱
由於對matlab不熟..所以想問問各位大大
下面是我的code
想問一下
其中MaxIter是我的訓練次數~
而ErrorR,ErrorG,ErrorM
分別是我的錯誤率!!~
我想要畫出..一個曲線圖..其中
X軸為我訓練次數...(若MaxIter,則顯示lrn_num 1~5)
Y軸為我的錯誤率!!~(1~5時各自的錯誤率)
要怎樣寫呢..
麻煩會的大大幫個忙..謝謝[code cpp]% Step1: reading Data from the file
FullData = load('sample.txt');
FullLabels = load('sample_Label.txt');
% Step2: splitting data to training and control set
TrainData = FullData(:,1:2:end);%(:,1:2:end)
TrainLabels = FullLabels(:,1:2:end)
ControlData = FullData(:,2:2:end);
ControlLabels = FullLabels(:,2:2:end);
MaxIter =10;
% Step3: constructing weak learner
weak_learner = tree_node_w(3); % pass the number of tree splits to the constructor
for lrn_num = 1 : MaxIter
clc;
disp(strcat(' Boosting step: ', num2str(lrn_num),'/', num2str(MaxIter)));

%training gentle adaboost
[GLearners GWeights] = GentleAdaBoost(weak_learner, TrainData, TrainLabels, lrn_num);

%evaluating control error
ResultG = sign(Classify(GLearners, GWeights, ControlData));

ErrorG = sum(ControlLabels ~= ResultG)/ length(ControlLabels)
%training real adaboost
[RLearners RWeights] = RealAdaBoost(weak_learner, TrainData, TrainLabels, lrn_num);;

%evaluating control error
RControl = sign(Classify(RLearners, RWeights, ControlData));

ErrorR = sum(ControlLabels ~= RControl)/ length(ControlLabels)
%training modest adaboost
[MLearners MWeights] = ModestAdaBoost(weak_learner, TrainData, TrainLabels, lrn_num);

%evaluating control error
ResultM = sign(Classify(MLearners, MWeights, ControlData));

ErrorM = sum(ControlLabels ~= ResultM)/ length(ControlLabels)

end[/code]
系統時間:2024-11-21 19:54:33
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!