-
Notifications
You must be signed in to change notification settings - Fork 1
/
final_presentation.asv
67 lines (55 loc) · 1.97 KB
/
final_presentation.asv
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%% Test notes
%% % *Weak classifiers: Tree,Knn,Discriminant
%* Tweak Nlearners
%* other params (
%* for Bag: try 'regression' too
%* for Boost: try different boosts
%* for Stacking ?:
%For table: use start=tic; time=toc(start); and Evaluate fcn (needs modifiyng for multi class)
% So we have same data to put on table
%plots: dimention vs. class , 2-dimension vs. class rtc.
% http://web.cs.wpi.edu/~ruiz/KDDRG/Resources/Clustering/viewClusters.png
% have the plot template on github if you have one please.
%rsLoss = resubLoss(ClassTreeEns,'Mode','Cumulative');
%
%%
rng(12312,'twister')
%% Poker Data set
load poker-hand-testing.data
load poker-hand-training-true.data
%%
pokerTest.Data = poker_hand_testing(:,1:end-1);
pokerTest.Labels = poker_hand_testing(:,end);
pokerTrain.Data = poker_hand_training_true(:,1:end-1);
pokerTrain.Labels = poker_hand_training_true(:,end);
%% Creating claffication noise to test
% http://www.phillong.info/publications/LS10_potential.pdf
T = length(pokerTrain.Data);
LabelNoise = round(normrnd(0, 0.32, T,1));
pokerTrain.NoisyLabels = pokerTrain.Labels + LabelNoise;
%error ratio
pokerTrain.er_rat = sum(pokerTrain.NoisyLabels ~= pokerTrain.Labels)/T
%% Wine Data set
load wine.data
%%
windex =cvpartition(wine(:,1),'Holdout',0.25);
wineTrain.Data=wine(windex.train(),2:end);
wineTrain.Labels=wine(windex.train(),1);
T = length(pokerTrain.Data);
LabelNoise = round(normrnd(0, 0.32, T,1));
pokerTrain.NoisyLabels = pokerTrain.Labels + LabelNoise;
wineTest.Data=wine(windex.test(),2:end);
wineTest.Labels=wine(windex.test(),1);
%% Bagging
pokerBag.mdlTree = fitensemble(pokerTrain.Data,pokerTrain.Labels, ...
'Bag', 20, 'Tree', 'Type', 'classification');
%%
%[~, score]=oobPredict(poker.bag)
pokerBag.predict=predict(pokerBag.mdlTree,pokerTest.Data);
%%
sum(pokerBag.predict==pokerTest.Labels)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% B. Boosting
finalBoost
%% Stacking
%% Results Table and Plots