]> git.donarmstrong.com Git - mothur.git/blob - abstractdecisiontree.hpp
changed random forest's inheritance
[mothur.git] / abstractdecisiontree.hpp
1 //
2 //  abstractdecisiontree.hpp
3 //  rrf-fs-prototype
4 //
5 //  Created by Abu Zaher Faridee on 7/22/12.
6 //  Copyright (c) 2012 Schloss Lab. All rights reserved.
7 //
8
9 #ifndef rrf_fs_prototype_abstractdecisiontree_hpp
10 #define rrf_fs_prototype_abstractdecisiontree_hpp
11
12 #include "mothurout.h"
13 #include "macros.h"
14 #include "rftreenode.hpp"
15
16 #define DEBUG_MODE
17
18 /**************************************************************************************************/
19
20 class AbstractDecisionTree{
21   
22 public:
23   
24     AbstractDecisionTree(vector<vector<int> >baseDataSet, 
25                        vector<int> globalDiscardedFeatureIndices, 
26                        OptimumFeatureSubsetSelector optimumFeatureSubsetSelector, 
27                        string treeSplitCriterion);    
28     virtual ~AbstractDecisionTree(){}
29     
30   
31 protected:
32   
33     virtual int createBootStrappedSamples();
34     virtual int getMinEntropyOfFeature(vector<int> featureVector, vector<int> outputVector, double& minEntropy, int& featureSplitValue, double& intrinsicValue);
35     virtual int getBestSplitAndMinEntropy(vector< vector<int> > featureOutputPairs, vector<int> splitPoints, double& minEntropy, int& minEntropyIndex, double& relatedIntrinsicValue);
36     virtual double calcIntrinsicValue(int numLessThanValueAtSplitPoint, int numGreaterThanValueAtSplitPoint, int numSamples);
37     virtual double calcSplitEntropy(vector< vector<int> > featureOutputPairs, int splitIndex, int numOutputClasses, bool);
38     virtual int getSplitPopulation(RFTreeNode* node, vector< vector<int> >& leftChildSamples, vector< vector<int> >& rightChildSamples);
39     virtual bool checkIfAlreadyClassified(RFTreeNode* treeNode, int& outputClass);
40
41     vector< vector<int> > baseDataSet;
42     int numSamples;
43     int numFeatures;
44     int numOutputClasses;
45     vector<int> outputClasses;
46     vector< vector<int> > bootstrappedTrainingSamples;
47     vector<int> bootstrappedTrainingSampleIndices;
48     vector< vector<int> > bootstrappedTestSamples;
49     vector<int> bootstrappedTestSampleIndices;
50     
51     RFTreeNode* rootNode;
52     vector<int> globalDiscardedFeatureIndices;
53     int optimumFeatureSubsetSize;
54     string treeSplitCriterion;
55     MothurOut* m;
56   
57 private:
58     
59   
60 };
61 /**************************************************************************************************/
62
63 #endif