[bc3db1]: / Ensemble Learning / AdaBoost / predStump.m

Download this file

11 lines (9 with data), 240 Bytes

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