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