2 // abstractrandomforest.hpp
5 // Created by Abu Zaher Faridee on 7/20/12.
6 // Copyright (c) 2012 Schloss Lab. All rights reserved.
9 #ifndef rrf_fs_prototype_abstractrandomforest_hpp
10 #define rrf_fs_prototype_abstractrandomforest_hpp
12 #include "mothurout.h"
14 #include "abstractdecisiontree.hpp"
18 /***********************************************************************/
20 class AbstractRandomForest{
22 // intialization with vectors
23 AbstractRandomForest(const std::vector < std::vector<int> > dataSet,
24 const int numDecisionTrees,
26 virtual ~AbstractRandomForest(){ }
27 virtual int populateDecisionTrees() = 0;
28 virtual int calcForrestErrorRate() = 0;
29 virtual int calcForrestVariableImportance(string) = 0;
31 /***********************************************************************/
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
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
46 vector<int> getGlobalDiscardedFeatureIndices();
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;
59 // TODO: fix this, do we use pointers?
60 vector<AbstractDecisionTree*> decisionTrees;