5 // Created by Abu Zaher Faridee on 7/20/12.
6 // Copyright (c) 2012 Schloss Lab. All rights reserved.
9 #ifndef RF_RANDOMFOREST_HPP
10 #define RF_RANDOMFOREST_HPP
14 #include "decisiontree.hpp"
16 class RandomForest: public Forest {
20 RandomForest(const vector <vector<int> > dataSet,
21 const int numDecisionTrees,
22 const string treeSplitCriterion,
24 const float pruneAggressiveness,
25 const bool discardHighErrorTrees,
26 const float highErrorTreeDiscardThreshold,
27 const string optimumFeatureSubsetSelectionCriteria,
28 const float featureStandardDeviationThreshold);
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
42 int calcForrestErrorRate();
43 int calcForrestVariableImportance(string);
44 int populateDecisionTrees();
45 int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree);
46 int printConfusionMatrix(map<int, string> intToTreatmentMap);
47 int getMissclassifications(string, map<int, string> intToTreatmentMap, vector<string> names);