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