📄 geterror.m
字号:
%%% file: getError.m% This function calculates the error returned by the current run of the weak learner.%%function [errorTrain,errorTest]=getError(boost,train,train_label,test,test_label) disp('run getError'); d=size(boost); num=size(train); prediction=zeros(num(1),1); % geting the train error for h=1:d(1) prediction=prediction-log(boost(h,1))*(train(:,boost(h,2))>=boost(h,3)); end temp=-sum(log(boost(:,1)))/2; errorTrain=sum(abs((train_label>=5)-(prediction>=temp)))/num(1); prediction=zeros(1000,1); % geting the test error for h=1:d(1) prediction=prediction-log(boost(h,1))*(test(:,boost(h,2))>=boost(h,3)); end errorTest=sum(abs((test_label>=5)-(prediction>=temp)))/1000;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -