Main Page | Modules | Data Structures | File List | Globals | Related Pages

DecisionTree.h

Go to the documentation of this file.
00001 #ifndef DECISIONTREEH
00002 #define DECISIONTREEH
00003 
00007 #include "ExampleSpec.h"
00008 #include "Example.h"
00009 #include "../util/lists.h"
00010 /*#include <stdio.h>*/
00011 
00012 
00038 typedef enum { dtnLeaf, dtnContinuous, dtnDiscrete, dtnGrowing } NodeType;
00039 
00044 typedef struct _DecisionTree_ {
00045    NodeType nodeType;
00046 
00047    ExampleSpecPtr spec;
00048    void *growingData;
00049 
00050    int splitAttribute;
00051    float splitThreshold; /* for continuous attributes */
00052 
00053    VoidAListPtr children;
00054 
00055    int myclass;
00056 
00057    float *classDistribution;
00058    float distributionSampleCount;
00059 } DecisionTree, *DecisionTreePtr;
00060 
00066 DecisionTreePtr DecisionTreeNew(ExampleSpecPtr spec);
00067 
00075 void DecisionTreeFree(DecisionTreePtr dt);
00076 
00082 DecisionTreePtr DecisionTreeClone(DecisionTreePtr dt);
00083 
00085 int DecisionTreeIsLeaf(DecisionTreePtr dt);
00086 
00090 int DecisionTreeIsTreeGrowing(DecisionTreePtr dt);
00091 
00093 int DecisionTreeIsNodeGrowing(DecisionTreePtr dt);
00094 
00100 int DecisionTreeGetClass(DecisionTreePtr dt);
00101 
00108 void DecisionTreeSetClass(DecisionTreePtr dt, int theClass);
00109 
00117 void DecisionTreeAddToClassDistribution(DecisionTreePtr dt, ExamplePtr e);
00118 
00124 float DecisionTreeGetClassProb(DecisionTreePtr dt, int theClass);
00125 
00131 void  DecisionTreeSetClassProb(DecisionTreePtr dt, int theClass, float prob);
00132 
00134 float DecisionTreeGetClassDistributionSampleCount(DecisionTreePtr dt);
00135 
00137 void DecisionTreeZeroClassDistribution(DecisionTreePtr dt);
00138 
00146 void DecisionTreeSetTypeLeaf(DecisionTreePtr dt);
00147 
00149 void DecisionTreeSetTypeGrowing(DecisionTreePtr dt);
00150 
00157 void DecisionTreeSplitOnDiscreteAttribute(DecisionTreePtr dt,
00158                                                             int attNum);
00159 
00166 void DecisionTreeSplitOnContinuousAttribute(DecisionTreePtr dt,
00167                                             int attNum, float threshold);
00168 
00174 int DecisionTreeGetChildCount(DecisionTreePtr dt);
00175 
00182 DecisionTreePtr DecisionTreeGetChild(DecisionTreePtr dt, int index);
00183 
00190 DecisionTreePtr DecisionTreeOneStepClassify(DecisionTreePtr dt, ExamplePtr e);
00191 
00193 int DecisionTreeClassify(DecisionTreePtr dt, ExamplePtr e);
00194 
00196 void DecisionTreeGatherGrowingNodes(DecisionTreePtr dt, VoidAListPtr list);
00197 
00199 void DecisionTreeGatherLeaves(DecisionTreePtr dt, VoidAListPtr list);
00200 
00202 int  DecisionTreeCountNodes(DecisionTreePtr dt);
00203 
00205 int DecisionTreeGetMostCommonClass(DecisionTreePtr dt);
00206 
00214 void DecisionTreeSetGrowingData(DecisionTreePtr dt, void *data);
00215 
00216 
00221 void *DecisionTreeGetGrowingData(DecisionTreePtr dt);
00222 
00223 
00232 void DecisionTreePrint(DecisionTreePtr dt, FILE *out);
00233 
00234 
00240 void DecisionTreePrintStats(DecisionTreePtr dt, FILE *out);
00241 
00242 
00254 DecisionTreePtr DecisionTreeReadC45(FILE *in, ExampleSpecPtr spec);
00255 DecisionTreePtr DecisionTreeReadC45Overprune(FILE *in, ExampleSpecPtr spec);
00256 
00265 DecisionTreePtr DecisionTreeRead(FILE *in, ExampleSpecPtr spec);
00266 
00278 void DecisionTreeWrite(DecisionTreePtr dt, FILE *out);
00279 
00280 #endif /* DECISIONTREEH */
00281 

Generated for VFML by doxygen hosted by SourceForge.net Logo