% experiment 4: revise 1

iterationNum = 20;

%1NN
nnadatrerr = zeros(1, iterationNum);
nnadatserr = zeros(1, iterationNum);
weight = zeros(iterationNum, size(nfea_tr,2));
nnrivtrerr = zeros(1, iterationNum);
nnrivtserr = zeros(1, iterationNum);
rivw = zeros(iterationNum, size(nfea_tr,2));

for t = 1:iterationNum
    [nnadatrerr(t), nnadatserr(t), weight(t,:)] = adaboostM1('nearest', nfea_tr, lab_tr, nfea_ts, lab_ts, t, 6);
    [nnrivtrerr(t), nnrivtserr(t), rivw(t,:)] = adaboostM1_revise1('nearest', nfea_tr, lab_tr, nfea_ts, lab_ts, t, 6);
end

figure;
x = 1:iterationNum;
plot(x, nnadatserr, '-xb', x, nnrivtserr, '-or');
axis([1 iterationNum 0 0.2]);
title('AdaBoost Revise 1');
xlabel('iteration number');
ylabel('error rate');
legend( 'adaboost test error', 'revise1 test error');

