a | b/Ensemble Learning/AdaBoost/predStump.m | ||
---|---|---|---|
1 | % Make prediction based on a decision stump |
||
2 | |||
3 | function label = predStump(X, stump) |
||
4 | N = size(X, 1); |
||
5 | x = X(:, stump.dim); |
||
6 | idx = logical(x >= stump.threshold); % N x 1 |
||
7 | label = zeros(N, 1); |
||
8 | label(idx) = stump.more; |
||
9 | label(~idx) = stump.less; |
||
10 | end |