/* /--------------------------------------------------------------------\ | File : Complex.H | |--------------------------------------------------------------------| | Written by : Umit CATALYUREK | | Date : 1.6.1993 | |--------------------------------------------------------------------| | Description : Implementation of CN2 for Machine Learning Course. | | Header File For Selectors & Complexes | |--------------------------------------------------------------------| | Last Modification Date : | | By : | | Description : | \____________________________________________________________________/ */ #ifndef _COMPLEX_H_ #define _COMPLEX_H_ #define LESS_EQ 0 #define GREATER 1 #define EQUAL 2 #define NOTEQUAL 3 typedef struct TAGSelector { int attrind; char comp; int valind; } Selector; typedef Selector *PSelector; typedef struct TAGComplexNode { int sel; struct TAGComplexNode *next; } ComplexNode; typedef ComplexNode *PComplexNode; typedef struct TAGComplex /* Is orderder link list on field sel, to short cut compersions */ { PComplexNode sellist; int numofselectors, numofexamplescovered; int classdistr[MAXCLASS]; double entropy, significance; } Complex; typedef Complex *PComplex; typedef struct TAGComplexList { PComplex cpx; struct TAGComplexList *next, *prev; } ComplexList; typedef ComplexList *PComplexList; typedef struct TAGRule { PComplex cpx; int class; struct TAGRule *next; } Rule; typedef Rule *PRule; typedef struct TAGRuleList { PRule head, tail; } RuleList; /**** Proto-Types of functions ******/ void InitSelectors(); void DeallocateSelectors(); char *PrintSelector(); PComplexList Selectors2ComplexList(); /* Constructs a Complex List from Selectors */ void FreeComplex( /* PComplex */ ); PComplex CopyComplex( /* PComplex */ ); void DeallocateComplexList(); void AddRule(); void DeallocateRuleList(); PComplexList CopyComplexList(); char *PrintComplex(); int ComplexCover( /* PInstance , PComplex */); void Intersect(); /* Intersects star with selectors */ void Evaluate(/* &PComplexList */); /* Evaluates all complexes in list*/ int BetterComplex( /* c1, c2 */); /* Returns > 0 if first one (c1) is better a complex than c2 */ void WriteRuleList(); void ReadRuleList(); int RuleListMatch( /* PInstance */ ); /* returns one if prediction is correct */ /**** Debuging functions *******/ void printselectors(); void printcomplexlist(); void printrulelist(); #endif