5 // Created by Kathryn Iverson on 10/26/12. Modified abstractrandomforest
6 // Copyright (c) 2012 Schloss Lab. All rights reserved.
9 #ifndef __Mothur__forest__
10 #define __Mothur__forest__
13 #include "mothurout.h"
15 #include "decisiontree.hpp"
16 #include "abstractdecisiontree.hpp"
17 /***********************************************************************/
18 //this is a re-implementation of the abstractrandomforest class
22 // intialization with vectors
23 Forest(const std::vector < std::vector<int> > dataSet,
24 const int numDecisionTrees,
25 const string treeSplitCriterion,
27 const float pruneAggressiveness,
28 const bool discardHighErrorTrees,
29 const float highErrorTreeDiscardThreshold,
30 const string optimumFeatureSubsetSelectionCriteria,
31 const float featureStandardDeviationThreshold);
33 virtual int populateDecisionTrees() = 0;
34 virtual int calcForrestErrorRate() = 0;
35 virtual int calcForrestVariableImportance(string) = 0;
36 virtual int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree) = 0;
38 /***********************************************************************/
42 // TODO: create a better way of discarding feature
43 // currently we just set FEATURE_DISCARD_SD_THRESHOLD to 0 to solved this
44 // it can be tuned for better selection
45 // also, there might be other factors like Mean or other stuffs
46 // same would apply for createLocalDiscardedFeatureList in the TreeNode class
48 // TODO: Another idea is getting an aggregated discarded feature indices after the run, from combining
49 // the local discarded feature indices
50 // this would penalize a feature, even if in global space the feature looks quite good
51 // the penalization would be averaged, so this woould unlikely to create a local optmina
53 vector<int> getGlobalDiscardedFeatureIndices();
58 vector< vector<int> > dataSet;
59 vector<int> globalDiscardedFeatureIndices;
60 vector<double> globalVariableImportanceList;
61 string treeSplitCriterion;
64 float pruneAggressiveness;
65 bool discardHighErrorTrees;
66 float highErrorTreeDiscardThreshold;
67 string optimumFeatureSubsetSelectionCriteria;
68 float featureStandardDeviationThreshold;
70 // This is a map of each feature to outcome count of each classes
71 // e.g. 1 => [2 7] means feature 1 has 2 outcome of 0 and 7 outcome of 1
72 map<int, vector<int> > globalOutOfBagEstimates;
74 // TODO: fix this, do we use pointers?
75 vector<AbstractDecisionTree*> decisionTrees;
83 #endif /* defined(__Mothur__forest__) */