function [ab] = RealAdaBooster(cl, nStages) constructor of the realAdaBooster class that inherits from the classifier class. the realAdaBooster implements the RealAdaBoost boosting algorithm to build a strong (boosted) classifier from several weak classifiers. Inputs: cl: the weak classifier that needs to be boosted or another realAdaBooster that was trained with a specific number of stages and we need to increase them (default [])
0001 function [rab] = RealAdaBooster(cl) 0002 % function [ab] = RealAdaBooster(cl, nStages) 0003 % constructor of the realAdaBooster class that inherits from the classifier 0004 % class. the realAdaBooster implements the RealAdaBoost boosting algorithm to 0005 % build a strong (boosted) classifier from several weak classifiers. 0006 % 0007 % Inputs: 0008 % cl: the weak classifier that needs to be boosted or another 0009 % realAdaBooster that was trained with a specific number of stages 0010 % and we need to increase them (default []) 0011 0012 % parameters needed for training 0013 % the error bound after reaching which the classifier stops learning, 0014 % used only when the nStages argument to learn is Inf 0015 rab.errBound = 0.001; 0016 0017 % paramters needed to define the classifier 0018 if nargin == 0 0019 rab.weakCl = []; 0020 numClasses = 2; 0021 else 0022 rab.weakCl = cl; 0023 numClasses = getNumClasses(cl); 0024 end 0025 0026 % parameters to be learned by the classifier 0027 % 1. a cell array of trained instances of the weak classifier 0028 rab.trndCls = {}; 0029 0030 % 2. Number of stages 0031 rab.nStages = 0; 0032 0033 % 3. example weights of the last iteration of realAdaBoost learning 0034 % algorithm. this is saved after training the classifier to be used 0035 % later if we want to increase the number of stages later on 0036 rab.lastExWeights = []; 0037 0038 % 4. Weak classifiers weights 0039 rab.clsWeights = []; 0040 0041 % 5. the threshold whereby the classifier can distinguish between the 0042 % positive and negative examples 0043 rab.thresh = NaN; 0044 0045 % 6. detection rate after training 0046 rab.detectionRate = NaN; 0047 0048 rab = class(rab, 'RealAdaBooster', Classifier(numClasses));