X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=randomforest.hpp;fp=randomforest.hpp;h=716d1a1ede60c667840172db275814c73867041a;hb=035f86272c776e1cccaa47021e26782e49cd41e7;hp=0000000000000000000000000000000000000000;hpb=96dbe925073caefaed6e6db85659c144a806aeb1;p=mothur.git diff --git a/randomforest.hpp b/randomforest.hpp new file mode 100755 index 0000000..716d1a1 --- /dev/null +++ b/randomforest.hpp @@ -0,0 +1,45 @@ +// +// randomforest.hpp +// rrf-fs-prototype +// +// Created by Abu Zaher Faridee on 7/20/12. +// Copyright (c) 2012 Schloss Lab. All rights reserved. +// + +#ifndef rrf_fs_prototype_randomforest_hpp +#define rrf_fs_prototype_randomforest_hpp + +#include "macros.h" +#include "abstractrandomforest.hpp" +#include "decisiontree.hpp" + +class RandomForest: public AbstractRandomForest { + +public: + + // DONE + RandomForest(const vector > dataSet,const int numDecisionTrees, const string); + + + //NOTE:: if you are going to dynamically cast, aren't you undoing the advantage of abstraction. Why abstract at all? + //could cause maintenance issues later if other types of Abstract decison trees are created that cannot be cast as a decision tree. + virtual ~RandomForest() { + for (vector::iterator it = decisionTrees.begin(); it != decisionTrees.end(); it++) { + // we know that this is decision tree, so we can do a dynamic_case here + DecisionTree* decisionTree = dynamic_cast(*it); + // calling the destructor by deleting + delete decisionTree; + } + } + + int calcForrestErrorRate(); + int calcForrestVariableImportance(string); + int populateDecisionTrees(); + int updateGlobalOutOfBagEstimates(DecisionTree* decisionTree); + +private: + MothurOut* m; + +}; + +#endif