|
a |
|
b/classification/bagging/runBagging.m |
|
|
1 |
function [ bags ] = runBagging( X,Y,numIterations,minLeafs,rf ) |
|
|
2 |
%RUNBAGGING Summary of this function goes here |
|
|
3 |
% Detailed explanation goes here |
|
|
4 |
|
|
|
5 |
|
|
|
6 |
bags = cell(1,1); |
|
|
7 |
|
|
|
8 |
options = statset('UseParallel',true); |
|
|
9 |
|
|
|
10 |
numPrint = numIterations/10; |
|
|
11 |
|
|
|
12 |
for i=1:size(minLeafs,2) |
|
|
13 |
disp(strcat('Running leaf parameter: ', num2str(minLeafs(i)))); |
|
|
14 |
if(rf) |
|
|
15 |
bags{i} = TreeBagger(numIterations,X,Y,'Method',... |
|
|
16 |
'classification','OOBPred','on','minleaf',minLeafs(i),... |
|
|
17 |
'NVarToSample','all','NPrint',numPrint,'Options',options); |
|
|
18 |
else |
|
|
19 |
bags{i} = TreeBagger(numIterations,X,Y,'Method',... |
|
|
20 |
'classification','OOBPred','on','minleaf',minLeafs(i),... |
|
|
21 |
'NPrint',numPrint,'Options',options); |
|
|
22 |
end |
|
|
23 |
end |
|
|
24 |
|
|
|
25 |
end |
|
|
26 |
|