[b4b313]: / classification / RUSboost / test / RUSBoostTest.m

Download this file

39 lines (23 with data), 681 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
load covtype.data
Y = covtype(:,end);
covtype(:,end) = [];
tabulate(Y)
part = cvpartition(Y,'holdout',0.5);
istrain = training(part); % data for fitting
istest = test(part); % data for quality assessment
tabulate(Y(istrain))
testOne = covtype(istest,:);
testTwo = covtype(istest);
t = ClassificationTree.template('minleaf',5);
tic
rusTree = fitensemble(covtype(istrain,:),Y(istrain),'RUSBoost',1000,t,...
'LearnRate',0.1,'nprint',100);
toc
figure;
tic
plot(loss(rusTree,covtype(istest,:),Y(istest),'mode','cumulative'));
toc
grid on;
xlabel('Number of trees');
ylabel('Test classification error');
test = covtype(istest,:);