/*****************************************************************/ /* Definitions, variables, and routines in T2 which people might */ /* want to use their programs */ /*****************************************************************/ /***************/ /* Global data */ /***************/ extern int MaxAtt, /* max att number */ MaxClass, /* max class number */ MaxDiscrVal; /* max discrete values for any att */ extern ItemNo MaxItem; /* max data item number */ extern DiscrValue *MaxAttVal; /* number of values for each att [0..MaxAtt] 0 if attribute is continuous */ extern char *SpecialStatus; /* special att treatment, [0..MaxAtt] */ /* set to IGNORE if you don't want to split on this attribute */ extern String *ClassName, /* class names [0..MaxClass] */ *AttName, /* att names [0..MaxAtt] */ **AttValName, /* att value names */ FileName; /* family name of files */ extern ItemRec *Item; /* data items [0..MaxItem] */ #define Class(Case) Case[MaxAtt+1]._discr_val /* Class of ItemRec Case */ #define Weight(Case) Case[MaxAtt+2]._cont_val /* Weight of ItemRec Case can be modified by Weight(Case) = ... */ extern int MAXINTERVALS; /* maximal number of intervals at the bottom nodes */ /************/ /* Routines */ /************/ void CommandInput(int Argc, char* Argv[]); /* reads the process options In misc.c */ void GetNames(); /* Reads file FileName.data and initializes ClassName, AttName, AttValName, MaxAttVal, MaxAtt, MaxClass, MaxDiscrVal, SpecialStatus. Taken from C4.5. In getnames.c */ void GetData(String Extension); /* Reads file FileName.Extension and initializes Item, MaxItem. Taken from C4.5. In getdata.c */ Tree BuildTree(ItemNo Fp, ItemNo Lp, int Dep, ClassNo RootClass); /* Returns an optimal decision tree of depth at most Dep <= 2 for Item[Fp..Lp], Fp <= Lp. RootClass is the class of the parent node, might be None. In buildtree.c */ void PrintHeader(); /* Prints a header. Partly taken from C4.5. In output.c */ void InitializeData(); /* Initializes data structures used during the computation In init.c */ void PrintTree(Tree T); /* Prints tree T. Essentially taken from C4.5, including Show(), ShowBranch(), MaxLine(). In output.c */ void Evaluate(Tree T); /* Evaluates tree T on Item[0..MaxItem] and prints the result. Partly taken from C4.5. In output.c */ ClassNo Classify(ItemRec It, Tree T); /* Returns the classification of It by T. In misc.c */ Tree CopyTree(Tree T); /* Returns a copy of tree T In init.c */ void ReleaseTree(Tree T); /* Deletes tree T from memory In init.c */