]> git.donarmstrong.com Git - mothur.git/blob - randomforest.hpp
changed random forest output filename
[mothur.git] / randomforest.hpp
1 //
2 //  randomforest.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 RF_RANDOMFOREST_HPP
10 #define RF_RANDOMFOREST_HPP
11
12 #include "macros.h"
13 #include "forest.h"
14 #include "decisiontree.hpp"
15
16 class RandomForest: public Forest {
17     
18 public:
19     
20     RandomForest(const vector <vector<int> > dataSet,
21                  const int numDecisionTrees,
22                  const string treeSplitCriterion,
23                  const bool doPruning,
24                  const float pruneAggressiveness,
25                  const bool discardHighErrorTrees,
26                  const float highErrorTreeDiscardThreshold,
27                  const string optimumFeatureSubsetSelectionCriteria,
28                  const float featureStandardDeviationThreshold);
29     
30     
31     //NOTE:: if you are going to dynamically cast, aren't you undoing the advantage of abstraction. Why abstract at all?
32     //could cause maintenance issues later if other types of Abstract decison trees are created that cannot be cast as a decision tree.
33     virtual ~RandomForest() {
34         for (vector<AbstractDecisionTree*>::iterator it = decisionTrees.begin(); it != decisionTrees.end(); it++) {
35             // we know that this is decision tree, so we can do a dynamic_case<DecisionTree*> here
36             DecisionTree* decisionTree = dynamic_cast<DecisionTree*>(*it);
37             // calling the destructor by deleting
38             delete decisionTree;
39         }
40     }
41     
42     int calcForrestErrorRate();
43     int calcForrestVariableImportance(string);
44     int populateDecisionTrees();
45     int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree);
46     
47 private:
48     MothurOut* m;
49     
50 };
51
52 #endif