📄 strongclassify.m
字号:
function [Result]=StrongClassify(X,H,alpha,WLearner) %% Input% X - vector to be classified% H - array of selected best hypotheses% H(i) is a stucture of parameters characteristic of i-th hypothesis% parameters depend on the learning procedure % alpha - array of weights for every hypothesis % determined by the learning procedure%% Output:% Result - 0 if X does not belong to the class,1 else %% NOTE: Before doing classification you need to have called AdaBoost learner to% learn hypotheses H and get their weights (measure of importance) alpha%number of hypotheses finally selectedT=size(H,2);if (T~=size(alpha)) return;end;N=size(X,1);Result=zeros(N,1);for j=1:N accum_result=0; thresh=0; for i=1:T accum_result=accum_result+alpha(i)*WeakClassify(X(j,:),H{i},WLearner); thresh=thresh+alpha(i); end; res=accum_result>thresh/2; Result(j)=res;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -