/****************************************/ /* Definitions in T2 which people might */ /* want to use their programs */ /****************************************/ /*********/ /* Types */ /*********/ typedef int ItemNo; /* data item number */ typedef float ItemCount; /* weight of items */ typedef int ClassNo, /* class number, 0..MaxClass */ DiscrValue; /* discrete attribute value (0 = unknown) */ typedef int Attribute; /* attribute number, 0..MaxAtt */ /***************/ /* Definitions */ /***************/ #define None -1 #define IGNORE 1 /* special attribute status: do not use this attribute */ #define Unknown -1.23*Infinity /* unknown value for continuous attribute */ /********************************/ /* Format of the decision trees */ /********************************/ #define BrNone 0 /* node types: leaf */ #define BrDiscr 1 /* discrete branch */ #define BrIntervals 2 /* cut in intervals */ typedef struct _tree_record *Tree; typedef struct _tree_record { int NodeType; /* 0=leaf 1=branch 2=interval */ ClassNo BestClass; /* most frequent class at this node */ ItemCount Freq, /* no of items at this node */ Error; /* no of errors at this node */ Attribute Tested; /* attribute referenced in test */ int Forks; /* number of regular branches at this node */ float *Cut; /* thresholds for continuous attribute */ Tree *Branch; /* Branch[x] = (sub)tree for outcome x */ } TreeRec; /* Branch[0] is used if the attribute value is unknown. */ /* A node of type interval cuts the attribute values X in the following way: if( X < Cut[1] ) use Branch[1]; if( Cut[i-1] <= X < Cut[i] ) use Branch[i]; ( for i=2,...,Forks-1 ) if( Cut[Forks-1] <= X ) use Branch[Forks]; Cut[0] is unused */