a b/classification/bagging/bagSomeData.m
1
%% Script Description
2
% A script that runs both RUSBoosting and plots the final ensemble 
3
% error.
4
5
6
%% Setup the workspace and load the data
7
8
    %clean up the variables and remove from the console window.
9
    clear all;
10
    clc;
11
    close all;
12
    
13
    addpath('data');
14
    %load radiologist's dataset
15
    LIDCData = xlsread('sample_set.xlsx');
16
    
17
    %very specific to this dataset
18
    X = LIDCData(:,10:83);
19
    Y = LIDCData(:,end);
20
    
21
    %Open Matlab pool for multi-threading
22
    if(matlabpool('size') == 0) %checking to see if my pool is already open
23
       matlabpool open 4
24
    end
25
    
26
%% run bagging    
27
    rfName = 'Random Forest';
28
    bagName = 'Bagging';
29
    leafs = [1 5 10 20 50 100];
30
    
31
    tic
32
    disp('Running Bagging...');
33
    bags = runBagging(X,Y,200,leafs,0);
34
    disp('Bagging complete! Running Random Forest...');
35
    rfs = runBagging(X,Y,200,leafs,1);
36
    toc
37
    
38
    %close matlab pool
39
    matlabpool close;
40
    
41
%% graph the error
42
    tic
43
    disp('Random Forest complete! Graphing OOB...');
44
    graphBags(bags,leafs,bagName);
45
    graphBags(rfs,leafs,rfName);
46
    disp('Graphing Complete!');
47
    toc
48
    
49
%% Wrap up
50
51
    
52
    %send a message out
53
    matlabMail('Pinkjello92@gmail.com','Bagging and RF Complete!');