]> git.donarmstrong.com Git - mothur.git/blob - forest.h
sffinfo bug with flow grams right index when clipQualRight=0
[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 "decisiontree.hpp"
16 #include "abstractdecisiontree.hpp"
17 /***********************************************************************/
18 //this is a re-implementation of the abstractrandomforest class
19
20 class Forest{
21 public:
22     // intialization with vectors
23     Forest(const std::vector < std::vector<int> > dataSet,
24                          const int numDecisionTrees,
25                          const string);
26     virtual ~Forest(){ }
27     virtual int populateDecisionTrees() = 0;
28     virtual int calcForrestErrorRate() = 0;
29     virtual int calcForrestVariableImportance(string) = 0;
30     virtual int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree) = 0;
31     
32     /***********************************************************************/
33     
34 protected:
35     
36     // TODO: create a better way of discarding feature
37     // currently we just set FEATURE_DISCARD_SD_THRESHOLD to 0 to solved this
38     // it can be tuned for better selection
39     // also, there might be other factors like Mean or other stuffs
40     // same would apply for createLocalDiscardedFeatureList in the TreeNode class
41     
42     // TODO: Another idea is getting an aggregated discarded feature indices after the run, from combining
43     // the local discarded feature indices
44     // this would penalize a feature, even if in global space the feature looks quite good
45     // the penalization would be averaged, so this woould unlikely to create a local optmina
46     
47     vector<int> getGlobalDiscardedFeatureIndices();
48     
49     int numDecisionTrees;
50     int numSamples;
51     int numFeatures;
52     vector< vector<int> > dataSet;
53     vector<int> globalDiscardedFeatureIndices;
54     vector<double> globalVariableImportanceList;
55     string treeSplitCriterion;
56     // This is a map of each feature to outcome count of each classes
57     // e.g. 1 => [2 7] means feature 1 has 2 outcome of 0 and 7 outcome of 1
58     map<int, vector<int> > globalOutOfBagEstimates;
59     
60     // TODO: fix this, do we use pointers?
61     vector<AbstractDecisionTree*> decisionTrees;
62     
63     MothurOut* m;
64     
65 private:
66     
67 };
68
69 #endif /* defined(__Mothur__forest__) */