]> git.donarmstrong.com Git - mothur.git/blob - abstractrandomforest.hpp
fixes while testing 1.33.0
[mothur.git] / abstractrandomforest.hpp
1 //
2 //  abstractrandomforest.hpp
3 //  rrf-fs-prototype
4 //
5 //  Created by Abu Zaher Faridee on 7/20/12.
6 //  Copyright (c) 2012 Schloss Lab. All rights reserved.
7 //
8
9 #ifndef rrf_fs_prototype_abstractrandomforest_hpp
10 #define rrf_fs_prototype_abstractrandomforest_hpp
11
12 #include "mothurout.h"
13 #include "macros.h"
14 #include "abstractdecisiontree.hpp"
15
16 #define DEBUG_MODE
17
18 /***********************************************************************/
19
20 class AbstractRandomForest{
21 public:
22     // intialization with vectors
23     AbstractRandomForest(const std::vector < std::vector<int> > dataSet, 
24                        const int numDecisionTrees, 
25                        const string);
26     virtual ~AbstractRandomForest(){ }
27     virtual int populateDecisionTrees() = 0;
28     virtual int calcForrestErrorRate() = 0;
29     virtual int calcForrestVariableImportance(string) = 0;
30  
31 /***********************************************************************/
32   
33 protected:
34   
35     // TODO: create a better way of discarding feature
36     // currently we just set FEATURE_DISCARD_SD_THRESHOLD to 0 to solved this
37     // it can be tuned for better selection
38     // also, there might be other factors like Mean or other stuffs
39     // same would apply for createLocalDiscardedFeatureList in the TreeNode class
40   
41     // TODO: Another idea is getting an aggregated discarded feature indices after the run, from combining
42     // the local discarded feature indices
43     // this would penalize a feature, even if in global space the feature looks quite good
44     // the penalization would be averaged, so this woould unlikely to create a local optmina
45     
46     vector<int> getGlobalDiscardedFeatureIndices();
47     
48     int numDecisionTrees;
49     int numSamples;
50     int numFeatures;
51     vector< vector<int> > dataSet;
52     vector<int> globalDiscardedFeatureIndices;
53     vector<double> globalVariableImportanceList;
54     string treeSplitCriterion;
55     // This is a map of each feature to outcome count of each classes
56     // e.g. 1 => [2 7] means feature 1 has 2 outcome of 0 and 7 outcome of 1
57     map<int, vector<int> > globalOutOfBagEstimates;
58     
59     // TODO: fix this, do we use pointers?
60     vector<AbstractDecisionTree*> decisionTrees;
61     
62     MothurOut* m;
63   
64 private:
65
66 };
67 #endif