diff -Nu ../c45rel8/R8/Src/CHANGES ./CHANGES
--- ../c45rel8/R8/Src/CHANGES	Thu Jan  1 01:00:00 1970
+++ ./CHANGES	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,69 @@
+This describes the changes and additions included in the 
+OFAI-patch.
+
+Portability note:
+  small differences between LINUX and Solaris compiled
+  programs are probably due to floating point 
+  inaccuracies.
+
+
+2000-03-16: modification of info.c to avoid a compiler bug
+  with GNU C 2.95.1. on LINUX and DOS systems
+  In the code section
+     N = V[v];
+     Sum += N * Log(N);
+  code generated with the -O option will always generate NaN.
+
+  Inserting an otherwise useless statement like:
+   N = V[v];
+   if (Log(N) > 9999999.999) { printf(""); }
+   Sum += N * Log(N);
+  will make the code work es expected again!
+
+
+Original:
+
+Note that the programs consult and consultr have not been
+modified; none of the modifications described below
+have been incorporated to these programs, unless the
+automatically also apply to them (f.i. missing value
+representation)
+
+- Programs made more portable; now compile under DOS
+  using MSVC++ and CygWin32
+
+- missing value representation for continuous attributes 
+  changed from -999 to FLT_MIN, for GNU compiler, and
+  1.1E-38 for other compilers.
+
+- added the program bconsult for creating a file that contains
+  the class labels assigned to the training or test set after
+  a tree has been built with the c4.5 program.
+
+- added the program bconsultr: same as bconsult for rules.
+
+- added the -h (help) option to some programs to show a short summary
+  of available options.
+
+- added the -I<n> (ignroe) option: n=1: ignore cases with MV as case label;
+  n=2: substitute first label from label list for MVs.
+
+- added the -T<n> (target) option: target (class) attribute is the
+  n-th attribute, not the last (as usual). When this option
+  is used, the .names file has to have a slightly different
+  format: the class label list at the beginning has to be ommited,
+  and an additional attribute description (discrete) has to 
+  be provided for the class attribute. Note that this format is
+  even then required, when the -T paramter specifies the
+  last attribute.
+
+- slight modification to the way class confusion matrices are
+  printed: a zero (0) will be printed instead of empty space.
+
+- Added the -S (suppress) option to suppress the printout of the generated
+  decision trees.
+
+- Added the -O (overfit) option to deliberatly generate an unpruned tree
+
+- Added the -M (modelname) option to store tree and rule files to
+  something like <filestem><modelname>.tree 
diff -Nu ../c45rel8/R8/Src/Makefile ./Makefile
--- ../c45rel8/R8/Src/Makefile	Fri Feb 28 23:52:09 2003
+++ ./Makefile	Sat Mar 15 11:02:56 2003
@@ -1,121 +1,173 @@
-#*************************************************************************#
-#*									 *#
-#*		Makefile for the C4.5 induction system			 *#
-#*		--------------------------------------			 *#
-#*									 *#
-#*************************************************************************#
+# -*-Mode:Makefile-*-
+# @(#)$Id: Makefile,v 1.14 1999/03/16 16:37:39 johann Exp $
 
+# Makefile for extended C4.5 for both UNIX and DOS
+# 
+# Comment out all you dont want, and uncomment what you need
+# for your specific configuration.
 
-#	Set CFLAGS for your C compiler, e.g.
-#
-#	  * if you need to debug the programs (sorry about that!)
-#	      CFLAGS = -g
-#	    (You might also want to reactivate the lint commands that
-#	    have been commented out below.)
-#
-#	  * if your C compiler supports higher optimization levels
-#	      CFLAGS = -O3 etc
 
+# C flags for DOS in DEBUG mode
+#CCFLGS = /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c /D "__DOS__"  /D "DEBUG" /D "DOS"  /Tc
+
+# C flags for DOS in RELEASE mode
+#CCFLGS = /D "_CONSOLE" /c /D "__DOS__" /D "DOS" /O2 /Og /Ot /TC /w /Za
+
+# With cygwin32 Gnu C under Windows, use one of the settings below, 
+# but change -D"UNIX" to -D"DOS"
+
+# C flags for UNIX in DEBUG mode
+#CCFLGS =  -c -w -D"UNIX" -g -O1
+
+# C flags for UNIX in RELEASE mode
+#CCFLGS = -c  -D"UNIX" -O3 -Wall -ansi
+#CCFLGS = -c  -D"DOS" -O3 -Wall -ansi
+CCFLGS = -c -D"LINUX" -O3 
+
+# LINK flags for DOS
+#LDFLGS = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:
+
+# LINK flags for UNIX 
+LDFLGS = -lm -o
+
+# compile command, DOS
+# CCCMD = cl
+
+# compile command, UNIX and DOS/cygwin32
+CCCMD = gcc
+
+# link command, DOS
+#LDCMD = link
+
+# link command, UNIX adn DOS/cygwin32
+LDCMD = gcc
 
-CFLAGS = -O2
+# delete command for clean, DOS
+#RMCMD = del
 
+# delete command for clean, UNIX
+RMCMD = /bin/rm -f
 
-#	Definitions of file sets
 
-core.ln = \
-	getnames.ln getdata.ln trees.ln getopt.ln header.ln
+# extensions for UNIX (use the object extension for DOS/cygwin32 too)
+XX = 
+XO = .o
 
-trees.ln = \
-	besttree.ln build.ln info.ln discr.ln contin.ln subset.ln\
-	prune.ln stats.ln st-thresh.ln classify.ln confmat.ln\
-	sort.ln $(core.ln)
+# extensions for DOS
+#XX = .exe
+#XO = .obj
+
+# install command for UNIX
+INSTCMD = /bin/cp
+
+# install command for DOS
+#INSTCMD = copy
+
+# install pathes for UNIX
+MANPATH = /usr/local/ml/man
+BINPATH = /usr/local/ml/bin
+
+
+#################################################################
+## END OF CONFIGURE STUFF
+#################################################################
+
+.SUFFIXES:
+.SUFFIXES: .c $(XO)
+.PHONY: patch
+#
+# THE executables to be created
+# 
+
+TARGETS = c4.5$(XX) c4.5rules$(XX) consult$(XX) bconsult$(XX) consultr$(XX) \
+          bconsultr$(XX) c4.5showtree$(XX) c4.5showrules$(XX) 
+
+MANUALS = c4.5.1 c4.5rules.1 verbose.1 verbrules.1 bconsult.1 consult.1 \
+	bconsultr.1 c4.5oefai.1 c4.5rulesoefai.1 c4.5showrules consultr.1  \
+	c4.5showtree.1 
+
+#
+# GROUPS OF OBJECTS FILES THAT BELONG TOGETHER
+#
 
-rules.ln = \
-	rules.ln genlogs.ln genrules.ln makerules.ln prunerule.ln\
-	siftrules.ln testrules.ln stats.ln confmat.ln sort.ln $(core.ln)
+core = getnames$(XO) getdata$(XO) trees$(XO) getopt$(XO) header$(XO)
 
-core = \
-	getnames.o getdata.o trees.o getopt.o header.o
+trees = besttree$(XO) build$(XO) info$(XO) discr$(XO) contin$(XO) \
+   subset$(XO) prune$(XO) stats$(XO) st-thresh$(XO) classify$(XO) \
+   confmat$(XO) sort$(XO) $(core)
 
-trees = \
-	besttree.o build.o info.o discr.o contin.o subset.o prune.o\
-	stats.o st-thresh.o classify.o confmat.o sort.o $(core)
+rules = rules$(XO) genlogs$(XO) genrules$(XO) makerules$(XO) prunerule$(XO)\
+        siftrules$(XO) testrules$(XO) stats$(XO) confmat$(XO) sort$(XO) $(core)
 
-rules = \
-	rules.o genlogs.o genrules.o makerules.o prunerule.o\
-	siftrules.o testrules.o stats.o confmat.o sort.o $(core)
+includes = buildex.i defns.i extern.i rulex.i types.i
 
+all: $(TARGETS)
 
-#  C4.5 decision tree generator
+$(core) $(tree) $(rules): $(includes)
 
-c4.5:	c4.5.o $(trees)
-#	lint -x c4.5.ln $(trees.ln) -lm
-	cc -o c4.5 c4.5.o $(trees) -lm
 
-#	(Sample only: for compiler that supports global optimization,
-#	 e.g. DECstation 3100)
+clean:
+	$(RMCMD) *$(XO) $(TARGETS) *~ patch
 
-c4.5gt:
-	cat	defns.i types.i\
-		c4.5.c\
-		besttree.c build.c info.c discr.c contin.c subset.c\
-		prune.c stats.c st-thresh.c confmat.c sort.c\
-		getnames.c getdata.c classify.c trees.c header.c\
-		| egrep -v 'defns.i|types.i|extern.i|buildex.i' >c4.5gt.c
-	cc -O4 -o c4.5gt c4.5gt.c -lm
-	rm c4.5gt.c
+install:  all
+	$(INSTCMD) $(TARGETS) $(BINPATH)
+	$(INSTCMD) $(MANUALS) $(MANPATH)/man1
 
+################
+# DEPENDENCIES
+################
 
-#  C4.5 production rule generator
+c4.5$(XX): c4.5$(XO) $(trees)
+	$(LDCMD) c4.5$(XO) $(trees) $(LDFLGS)$@	
 
-c4.5rules: c4.5rules.o $(rules)
-#	lint -x c4.5rules.ln $(rules.ln) -lm
-	cc -o c4.5rules c4.5rules.o $(rules) -lm
+c4.5rules$(XX): c4.5rules$(XO) $(rules)
+	$(LDCMD) c4.5rules$(XO) $(rules) $(LDFLGS)$@
 
+consult$(XX): consult$(XO) userint$(XO) $(core)
+	$(LDCMD) consult$(XO) userint$(XO) $(core) \
+        $(LDFLGS)$@
 
-c4.5rulesgt:
-	cat	defns.i types.i\
-		c4.5rules.c\
-		rules.c genlogs.c genrules.c makerules.c prunerule.c\
-		siftrules.c testrules.c stats.c confmat.c sort.c\
-		getnames.c getdata.c classify.c trees.c header.c\
-		| egrep -v 'defns.i|types.i|extern.i|rulex.i' >c4.5rulesgt.c
-	cc -O4 -o c4.5rulesgt c4.5rulesgt.c -lm
-	rm c4.5rulesgt.c
+bconsult$(XX): bconsult$(XO) $(trees)
+	$(LDCMD) bconsult$(XO) $(trees) \
+        $(LDFLGS)$@
 
+consultr$(XX): consultr$(XO) rules$(XO) userint$(XO) $(core)
+	$(LDCMD) consultr$(XO) rules$(XO) userint$(XO) $(core) \
+        $(LDFLGS)$@
 
+bconsultr$(XX): bconsultr$(XO)  $(rules)
+	$(LDCMD) bconsultr$(XO)   $(rules) \
+        $(LDFLGS)$@
 
-#  C4.5 decision tree interpreter
+c4.5showtree$(XX): c4.5showtree$(XO)  userint$(XO) $(core)
+	$(LDCMD) c4.5showtree$(XO) userint$(XO) $(core) \
+        $(LDFLGS)$@
 
-consult: consult.o userint.o $(core)
-#	lint -x consult.ln userint.ln $(core.ln)
-	cc -o consult consult.o userint.o $(core)
+c4.5showrules$(XX): c4.5showrules$(XO)  $(rules)
+	$(LDCMD) c4.5showrules$(XO) $(rules) \
+        $(LDFLGS)$@
 
 
-#  C4.5 production rule interpreter
+.c$(XO):
+	$(CCCMD) $(CCFLGS) $<
 
-consultr: consultr.o rules.o userint.o $(core)
-#	lint -x consultr.ln rules.ln userint.ln $(core.ln)
-	cc -o consultr consultr.o rules.o userint.o $(core)
+#########################################################
 
+# Stuff below this line only relevant for development ...
 
-.c.o:
-#	lint -c $<
-	cc $(CFLAGS) -c $<
 
 
+patch:  clean 
+	diff -Nu  ../c45rel8/R8/Src . > patch
 
+ALLDIST =  *.c *.i *.1 Makefile CHANGES Modifications 
 
-#  Make everything
+dist:
+	@echo CREATING DISTRIBUTION FILE
+	gtar -zcvf c45-oefai.tar.gz $(ALLDIST)
 
-all:
-	make c4.5
-	make c4.5rules
-	make consult
-	make consultr
-	cc -o xval-prep xval-prep.c
-	cc -o average average.c -lm
+dos-dist:
+	zip c45-oefai.zip $(ALLDIST)
 
+.phony: patch
 
-$(trees): defns.i types.i extern.i
-$(rules): defns.i types.i extern.i
diff -Nu ../c45rel8/R8/Src/average.c ./average.c
--- ../c45rel8/R8/Src/average.c	Fri Feb 28 23:52:09 2003
+++ ./average.c	Fri Feb 28 23:52:09 2003
@@ -14,6 +14,8 @@
 #define	MAXLINE		200	/* max line length */
 #define MAXVALS		 10	/* max values to be averaged */
 
+static char * rcsid = "@(#)$Id: average.c,v 1.2 1999/03/10 17:04:02 johann Exp $";
+
 
 main()
 {
diff -Nu ../c45rel8/R8/Src/bconsult.1 ./bconsult.1
--- ../c45rel8/R8/Src/bconsult.1	Thu Jan  1 01:00:00 1970
+++ ./bconsult.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,71 @@
+.\" troff -man %
+.\"
+.\" DO NOT EDIT
+.\"
+.\" This manual page is automatically generated by class2man.
+.\"
+.ds sV Mar 16, 1999
+.ds sC bconsult
+.ds sS 1
+.TH "\*(sC" "\*(sS" "\*(sV" "" ""
+.PP
+.SH "NAME"
+bconsult \- 
+Batch classify instances using C4.5 decision tree
+.SH "SYNOPSIS"
+.nf
+\f(CO
+bconsult [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>]
+\fP
+.fi
+.PP
+.SH "DESCRIPTION"
+This program allows the creation of a file containing class
+labels from a \f(CO.data\fP or a \f(CO.test\fP file and \f(CO.tree\fP file previously
+generated with the \f(COc4.5\fP program. The class labels will be stored
+into a file that has extension \f(CO.labs\fP.
+.PP
+.SH "ARGUMENTS"
+The program takes the following command-line arguments:
+.nf
+\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
+\f(CO-M<name>\fP: Add the given name to the filestem for the 
+    files containing the trees 
+    (fstem.tree and fstem.unpruned)
+    and the file that will contain the class labels
+    (fstem.labs)  (default: empty)
+\f(CO-u\fP: Use the unpruned tree, not the pruned one
+\f(CO-l\fP: Use the training data (fstem.data), not the
+    test data (fstem.test).
+\f(CO-v<n>\fP: Verbosity level (default: 0)
+\f(CO-t<n>\fP: Also print the tree (default: don't)
+\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
+    If this paramter is not give, the classic C4.5
+    scheme is used: the last attribute in the data file
+    contains the class label and the names file contains
+    the list of allowed class labels as its first entry.
+    If this parameter is given, any discrete attribute 
+    in the data file can be used as class attribute.
+    The names file must contain an attribute description
+    entry for all attribues, and must not contain the
+    initial entry describing the class labels (the class
+    labels are now described in the corresponding attribute
+    description entry)
+\f(CO-h\fP: Show help information about valid options
+.fi
+.PP
+.SH "DATE"
+$Date: 1999/03/16 16:37:40 $
+.PP
+.SH "NOTES"
+Note that the input file has to contain the attribute for 
+the class labels, even though its contents will not be used.
+The attribute must only contain values allowed as described
+in the names file, or missing value indicators (quetsion marks).
+.PP
+.SH "VERSION"
+$Revision: 1.3 $
+.PP
+.SH "AUTHOR(S)"
+Johann Petrak using big portions of the original code by 
+J.R. Quinlan
diff -Nu ../c45rel8/R8/Src/bconsult.c ./bconsult.c
--- ../c45rel8/R8/Src/bconsult.c	Thu Jan  1 01:00:00 1970
+++ ./bconsult.c	Sat Mar 15 10:36:56 2003
@@ -0,0 +1,300 @@
+ /*************************************************************************/
+/*									 */
+/*	bconsult          						 */
+/*	------------------						 */
+/*									 */
+/*************************************************************************/
+
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+// [bconsult]
+//
+// = FILENAME
+//   bconsult.c
+//
+// = AUTHOR(S)
+//   Johann Petrak using big portions of the original code by 
+//   J.R. Quinlan
+//
+// = TITLE
+//   Batch classify instances using C4.5 decision tree
+//
+// = DESCRIPTION
+//   This program allows the creation of a file containing class
+//   labels from a <.data> or a <.test> file and <.tree> file previously
+//   generated with the <c4.5> program. The class labels will be stored
+//   into a file that has extension <.labs>.
+//
+// = SYNOPSIS
+//   bconsult [-f\<fstem\>] [-M\<name\>] [-u] [-l] [-v\<n\>] [-t] [-T\<n\>]
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments:
+// = BEGIN<NOFILL>
+//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
+//   <-M\<name\>>: Add the given name to the filestem for the 
+//       files containing the trees 
+//       (fstem.tree and fstem.unpruned)
+//       and the file that will contain the class labels
+//       (fstem.labs)  (default: empty)
+//   <-u>: Use the unpruned tree, not the pruned one
+//   <-l>: Use the training data (fstem.data), not the
+//       test data (fstem.test).
+//   <-v\<n\>>: Verbosity level (default: 0)
+//   <-t\<n\>>: Also print the tree (default: don't)
+//   <-T\<n\>>: Specify target attribute number (counting from 1).
+//       If this paramter is not give, the classic C4.5
+//       scheme is used: the last attribute in the data file
+//       contains the class label and the names file contains
+//       the list of allowed class labels as its first entry.
+//       If this parameter is given, any discrete attribute 
+//       in the data file can be used as class attribute.
+//       The names file must contain an attribute description
+//       entry for all attribues, and must not contain the
+//       initial entry describing the class labels (the class
+//       labels are now described in the corresponding attribute
+//       description entry)
+//   <-h>: Show help information about valid options
+//   
+// = END<NOFILL>
+//
+// = NOTES
+//   Note that the input file has to contain the attribute for 
+//   the class labels, even though its contents will not be used.
+//   The attribute must only contain values allowed as described
+//   in the names file, or missing value indicators (quetsion marks).
+//
+// = VERSION
+//   $Revision: 1.9 $
+//
+// = DATE
+//   $Date: 1999/03/16 16:37:41 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+ */
+
+
+#include "defns.i"
+#include "types.i"
+
+static char * rcsid = "@(#)$Id: bconsult.c,v 1.9 1999/03/16 16:37:41 johann Exp $";
+
+    /*  External data, described in extern.i  */
+
+unsigned int NrMVClass = 0;
+
+short		MaxAtt, MaxClass, MaxDiscrVal = 2;
+
+ItemNo		MaxItem;
+
+Description	*Item;
+
+DiscrValue	*MaxAttVal;
+
+char		*SpecialStatus;
+
+String		*ClassName,
+                *ClassAttr,
+		*AttName,
+		**AttValName,
+                ModelSuffix = 0,
+		FileName = "DF";
+
+short		VERBOSITY = 0,
+                IGNOREMVCLASS = 0,
+		TRIALS    = 10;
+
+Boolean         PRINTTREE = true,
+                PRUNETREE  = true;
+
+Boolean		GAINRATIO  = true,
+		SUBSET     = false,
+		BATCH      = true,
+		UNSEENS    = false,
+		PROBTHRESH = false,
+	        TRACE      = false,
+                TRAIN      = false,
+	        UNPRUNED   = false;
+
+ItemNo		MINOBJS   = 2,
+		TARGETCOLUMN = 0,
+		WINDOW    = 0,
+		INCREMENT = 0;
+
+float		CF = 0.25;
+
+Tree		*Pruned;
+
+Tree   DecisionTree,			/* tree being used */
+       GetTree();
+
+Boolean		AllKnown = true;
+
+char suffixbuf[256];
+
+WriteLabs(Extension)
+  String Extension;
+{
+  char Fn[500];
+  FILE *TRf = 0;
+  
+  ClassNo RealClass, PrunedClass, Category();
+  short t;
+  ItemNo *ConfusionMat, i, PrunedErrors;
+  
+  strcpy(Fn, FileName);
+  strcat(Fn, Extension);
+  if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
+
+  ConfusionMat = (ItemNo *) calloc((MaxClass+1)*(MaxClass+1), sizeof(ItemNo));
+  
+  printf("\n");
+  
+  PrunedErrors = 0;
+
+  ForEach(i, 0, MaxItem)
+    {
+      RealClass = Class(Item[i]);
+      PrunedClass = Category(Item[i], DecisionTree);
+      
+      fprintf(TRf,"%s\n",ClassName[PrunedClass]);
+
+      if ( PrunedClass != RealClass ) PrunedErrors++;
+      ConfusionMat[RealClass*(MaxClass+1)+PrunedClass]++;
+    }
+      
+  fclose(TRf);
+
+  printf("\t%4d  %3d(%4.1f%%)\n",
+	 TreeSize(DecisionTree), PrunedErrors,
+	 100.0*PrunedErrors / (MaxItem+1.0));
+
+  
+  
+  PrintConfusionMatrix(ConfusionMat);
+  free(ConfusionMat);
+}
+
+
+    main(Argc, Argv)
+/*  ----  */
+    int Argc;
+    char *Argv[];
+{
+    int o;
+    extern char *optarg;
+    extern int optind;
+    Boolean FirstTime=true;
+    short Best, BestTree();
+
+    PrintHeader("(OFAI) labels from tree generator");
+
+    /*  Process options  */
+
+    while ( (o = getopt(Argc, Argv, "f:v:tuT:lM:hI:")) != EOF )
+    {
+	if ( FirstTime && o != 'h')
+	{
+	    printf("\n    Options:\n");
+	    FirstTime = false;
+	}
+
+	switch (o)
+	{
+	case 'f':   FileName = optarg;
+		    printf("\tFile stem <%s>\n", FileName);
+		    break;
+	case 'M':   ModelSuffix = optarg;
+		    printf("\tModel name <%s>\n", ModelSuffix);
+		    break;
+	case 'v':   VERBOSITY = atoi(optarg);
+		    printf("\tVerbosity level %d\n", VERBOSITY);
+		    break;
+	case 't':   TRACE = true;
+		    printf("\tPrint tree\n", VERBOSITY);
+		    break;
+	case 'u':   UNPRUNED = true;
+		    printf("\tUse unpruned tree\n", VERBOSITY);
+		    break;
+	case 'l':   TRAIN = true;
+		    printf("\tUse training (learning) set\n", VERBOSITY);
+		    break;
+	case 'T':   TARGETCOLUMN = atoi(optarg);
+	            printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		    break;
+	case 'I':   IGNOREMVCLASS = atoi(optarg);
+	            if (IGNOREMVCLASS == 0)
+		      printf("\tStandard handling of MVs as class values\n");
+		    else if  (IGNOREMVCLASS == 1)
+		      printf("\tIgnore cases with MV as class value\n");
+		    else if  (IGNOREMVCLASS == 2)
+		      printf("\tSubstitute first class label instead of MVs\n");
+		    else {
+		      printf("%s not a valid argument for option -I\n",optarg);
+		      exit(1);
+		    }
+		    break;
+	  case 'h': printf("usage: %s [options]\n", Argv[0]);
+	            printf("  options: [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>] \n");
+		    printf("  -f<fstem>: filestem (DF)\n");
+		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
+		    printf("  -u:        use unpruned tree (use pruned)\n");
+		    printf("  -l:        use training set (test set)\n");
+		    printf("  -v<n>:     verbosity level (0)\n");
+		    printf("  -t:        print tree (dont print tree)\n");
+		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
+		    printf("  -I<n>:     n=0: treat MV in class as error (default)\n");
+		    printf("             n=1: ignore records w/ MV in class\n");
+		    printf("             n=2: substitute first class label  (treat as error)\n");
+		    printf("  -h:        show this help info\n");
+		    printf("\n\n  The program will create a file <fstem>.labs that contains\n  the assigned class labels, one in each row\n");
+		    exit(1);
+		    break;
+	case '?':   printf("unrecognised option, use -h for help\n");
+		    exit(1);
+	}
+    }
+
+    /*  Initialise  */
+
+    GetNames();
+    
+    GetData(TRAIN ? ".data" : ".test");
+    printf("\nRead %d cases (%d attributes) from %s.%s\n",
+	   MaxItem+1, MaxAtt+1, FileName, (TRAIN ? "data" : "test"));
+
+    if (IGNOREMVCLASS == 1)
+      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
+    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
+      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
+    /* read the tree */
+    DecisionTree = GetTree((UNPRUNED ? ".unpruned" : ".tree"));
+    if ( TRACE ) PrintTree(DecisionTree);
+
+    /*GetData(".test");*/
+    printf("\nGenerate labels file from %s data (%d items):\n", 
+	   (TRAIN ? "training" : "test"), MaxItem+1);
+    
+    if (ModelSuffix == 0)
+      sprintf(suffixbuf,".labs");
+    else
+      sprintf(suffixbuf,"%s.labs",ModelSuffix);
+    WriteLabs(suffixbuf);
+
+
+    exit(0);
+}
+
+
+
+
diff -Nu ../c45rel8/R8/Src/bconsultr.1 ./bconsultr.1
--- ../c45rel8/R8/Src/bconsultr.1	Thu Jan  1 01:00:00 1970
+++ ./bconsultr.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,69 @@
+.\" troff -man %
+.\"
+.\" DO NOT EDIT
+.\"
+.\" This manual page is automatically generated by class2man.
+.\"
+.ds sV Mar 16, 1999
+.ds sC bconsultr
+.ds sS 1
+.TH "\*(sC" "\*(sS" "\*(sV" "" ""
+.PP
+.SH "NAME"
+bconsultr \- 
+Batch classify instances using C4.5 rules
+.SH "SYNOPSIS"
+.nf
+\f(CO
+bconsultr [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>]
+\fP
+.fi
+.PP
+.SH "DESCRIPTION"
+This program allows the creation of a file containing class
+labels from a \f(CO.data\fP or a \f(CO.test\fP file and \f(CO.rules\fP file previously
+generated with the \f(COc4.5rules\fP program. The class labels will be stored
+into a file that has extension \f(CO.labs\fP.
+.PP
+.SH "ARGUMENTS"
+The program takes the following command-line arguments:
+.nf
+\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
+\f(CO-M<name>\fP: Add the given name to the filestem for the 
+    files containing the rules (fstem.rules)
+    and the file that will contain the class labels
+    (fstem.labs)  (default: empty)
+\f(CO-l\fP: Use the training data (fstem.data), not the
+    test data (fstem.test).
+\f(CO-v<n>\fP: Verbosity level (default: 0)
+\f(CO-t<n>\fP: Also print the rules (default: don't)
+\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
+    If this paramter is not give, the classic C4.5
+    scheme is used: the last attribute in the data file
+    contains the class label and the names file contains
+    the list of allowed class labels as its first entry.
+    If this parameter is given, any discrete attribute 
+    in the data file can be used as class attribute.
+    The names file must contain an attribute description
+    entry for all attribues, and must not contain the
+    initial entry describing the class labels (the class
+    labels are now described in the corresponding attribute
+    description entry)
+\f(CO-h\fP: Show help information about valid options
+.fi
+.PP
+.SH "DATE"
+$Date: 1999/03/10 19:55:11 $
+.PP
+.SH "NOTES"
+Note that the input file has to contain the attribute for 
+the class labels, even though its contents will not be used.
+The attribute must only contain values allowed as described
+in the names file, or missing value indicators (quetsion marks).
+.PP
+.SH "VERSION"
+$Revision: 1.7 $
+.PP
+.SH "AUTHOR(S)"
+Johann Petrak using big portions of the original code by 
+J.R. Quinlan
diff -Nu ../c45rel8/R8/Src/bconsultr.c ./bconsultr.c
--- ../c45rel8/R8/Src/bconsultr.c	Thu Jan  1 01:00:00 1970
+++ ./bconsultr.c	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,322 @@
+/*************************************************************************/
+/*									 */
+/*  Generate labels for test cases using pre-generated rules     	 */
+/*  -----------------------------------------------------------------	 */
+/*									 */
+/*************************************************************************/
+
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+// [bconsultr]
+//
+// = FILENAME
+//   bconsultr.c
+//
+// = AUTHOR(S)
+//   Johann Petrak using big portions of the original code by 
+//   J.R. Quinlan
+//
+// = TITLE
+//   Batch classify instances using C4.5 rules
+//
+// = DESCRIPTION
+//   This program allows the creation of a file containing class
+//   labels from a <.data> or a <.test> file and <.rules> file previously
+//   generated with the <c4.5rules> program. The class labels will be stored
+//   into a file that has extension <.labs>.
+//
+// = SYNOPSIS
+//   bconsultr [-f\<fstem\>] [-M\<name\>] [-u] [-l] [-v\<n\>] [-t] [-T\<n\>]
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments:
+// = BEGIN<NOFILL>
+//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
+//   <-M\<name\>>: Add the given name to the filestem for the 
+//       files containing the rules (fstem.rules)
+//       and the file that will contain the class labels
+//       (fstem.labs)  (default: empty)
+//   <-l>: Use the training data (fstem.data), not the
+//       test data (fstem.test).
+//   <-v\<n\>>: Verbosity level (default: 0)
+//   <-t\<n\>>: Also print the rules (default: don't)
+//   <-T\<n\>>: Specify target attribute number (counting from 1).
+//       If this paramter is not give, the classic C4.5
+//       scheme is used: the last attribute in the data file
+//       contains the class label and the names file contains
+//       the list of allowed class labels as its first entry.
+//       If this parameter is given, any discrete attribute 
+//       in the data file can be used as class attribute.
+//       The names file must contain an attribute description
+//       entry for all attribues, and must not contain the
+//       initial entry describing the class labels (the class
+//       labels are now described in the corresponding attribute
+//       description entry)
+//   <-h>: Show help information about valid options
+//   
+// = END<NOFILL>
+//
+// = NOTES
+//   Note that the input file has to contain the attribute for 
+//   the class labels, even though its contents will not be used.
+//   The attribute must only contain values allowed as described
+//   in the names file, or missing value indicators (quetsion marks).
+//
+// = VERSION
+//   $Revision: 1.8 $
+//
+// = DATE
+//   $Date: 1999/03/16 16:37:42 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+ */
+
+#include "defns.i"
+#include "types.i"
+char suffixbuf[256];
+unsigned int NrMVClass = 0;
+
+static char * rcsid = "@(#)$Id: bconsultr.c,v 1.8 1999/03/16 16:37:42 johann Exp $";
+
+	/*  External data.  Note: uncommented variables have the same meaning
+	    as for decision trees  */
+
+short		MaxAtt, MaxClass, MaxDiscrVal,
+                IGNOREMVCLASS = 1;
+
+ItemNo		MaxItem, TARGETCOLUMN = 0;
+
+Description	*Item;
+
+DiscrValue	*MaxAttVal;
+
+char		*SpecialStatus;
+
+String		*ClassName,
+                *ClassAttr,
+		*AttName,
+		**AttValName,
+                ModelSuffix = 0,
+		FileName = "DF";
+
+short		VERBOSITY = 0,
+		TRIALS;
+
+Boolean		TRACE	  = false;
+
+Boolean         PRINTTREE = true;
+
+Boolean		UNSEENS	  = false,
+                TRAIN      = false,
+		SIGTEST	  = false,	/* use significance test in rule pruning */
+		SIMANNEAL = false;	/* use simulated annealing */
+
+float		SIGTHRESH   = 0.05,
+		CF	    = 0.25,
+		REDUNDANCY  = 1.0;	/* factor that guesstimates the
+					   amount of redundancy and
+					   irrelevance in the attributes */
+
+PR		*Rule;			/* current rules */
+
+RuleNo		NRules = 0,		/* number of current rules */
+		*RuleIndex;		/* rule index */
+
+short		RuleSpace = 0;		/* space allocated for rules */
+
+ClassNo		DefaultClass;		/* current default class */
+
+RuleSet		*PRSet;			/* sets of rulesets */
+
+float		AttTestBits,		/* bits to encode tested att */
+		*BranchBits;		/* ditto attribute value */
+
+
+char suffixbuf[256];
+
+float	Confidence;		/* certainty factor of fired rule */
+				/* (set by BestRuleInd) */
+
+
+ItemNo Interp(Extension)
+  String Extension;
+/*     ---------  */
+{
+  char Fn[500];
+  FILE *TRf = 0;
+  ItemNo i, Tested=0, Errors=0, *ConfusionMat;
+  ClassNo AssignedClass;
+  RuleNo p, ri, BestRuleInd();
+  float ErrorRate, BestRuleConfidence;
+  
+  strcpy(Fn, FileName);
+  strcat(Fn, Extension);
+  
+  if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
+
+  ConfusionMat = (ItemNo *) calloc((MaxClass+1)*(MaxClass+1), sizeof(ItemNo));
+  
+  ForEach(i, 0, MaxItem)
+    {
+      /*  Find first choice for rule for this item  */
+      
+      ri = BestRuleInd(Item[i], 1);
+      if (ri != 0)
+	AssignedClass =  Rule[ri].Rhs;
+      else
+	AssignedClass = DefaultClass;
+      
+      if (AssignedClass != Class(Item[i])) Errors++;
+      
+      fprintf(TRf,"%s\n",ClassName[AssignedClass]);
+      
+      ConfusionMat[Class(Item[i])*(MaxClass+1)+AssignedClass]++;
+      
+      Tested++;
+      
+    }
+  
+  fclose(TRf);
+  
+  printf("\nTested %d, errors %d (%.1f%%)\n",
+	 Tested, Errors, 100 * Errors / (float) Tested);
+  
+  PrintConfusionMatrix(ConfusionMat);
+  free(ConfusionMat);
+  
+  return Errors;
+}
+
+RuleNo BestRuleInd(CaseDesc, Start)
+/*     ---------------  */
+    Description CaseDesc;
+    RuleNo Start;
+{
+    RuleNo r, ri;
+    float Strength();
+
+    ForEach(ri, Start, NRules)
+    {
+	Confidence = Strength(Rule[ri], CaseDesc);
+
+	if ( Confidence > 0.1 )
+	{
+	    return ri;
+	}
+    }
+
+    Confidence = 0.0;
+    return 0;
+}
+
+
+    main(Argc, Argv)
+/*  ----  */
+    int Argc;
+    char *Argv[];
+{
+    int o;
+    extern char *optarg;
+    extern int optind;
+    Boolean FirstTime=true;
+    RuleNo r;
+
+    PrintHeader("label from rules generator");
+
+    /*  Process options  */
+
+    while ( (o = getopt(Argc, Argv, "f:v:tT:M:hl")) != EOF )
+    {
+	if ( FirstTime )
+	{
+	    printf("\n    Options:\n");
+	    FirstTime = false;
+	}
+
+	switch (o)
+	{
+	    case 'f':	FileName = optarg;
+			printf("\tFile stem <%s>\n", FileName);
+			break;
+	    case 'M':   ModelSuffix = optarg;
+		        printf("\tModel name <%s>\n", ModelSuffix);
+	    	        break;
+	    case 'v':	VERBOSITY = atoi(optarg);
+			printf("\tVerbosity level %d\n", VERBOSITY);
+			break;
+	case 'l':   TRAIN = true;
+		    printf("\tUse training (learning) set\n", VERBOSITY);
+		    break;
+	    case 't':	TRACE = true;
+			printf("\tShow rules used for labelling\n");
+			break;
+   	    case 'T':   TARGETCOLUMN = atoi(optarg);
+		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		        break;
+	  case 'h': printf("usage: %s [options]\n", Argv[0]);
+	            printf("  options: [-f<fstem>] [-M<name>] [-l] [-v<n>] [-t] [-T<n>] [-I<n>]\n");
+		    printf("  -f<fstem>: filestem (DF)\n");
+		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
+		    printf("  -l:        use training set (test set)\n");
+		    printf("  -v<n>:     verbosity level (0)\n");
+		    printf("  -t:        print rules (dont)\n");
+		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
+		    printf("  -h:        show this help info\n");
+		    printf("\n\n  The program will create a file <fstem>.labs that contains\n  the assigned class labels, one in each row\n");
+		    exit(1);
+		    break;
+	    case '?':	printf("unrecognised option\n");
+			exit(1);
+	}
+    } 
+
+    /*  Initialise  */
+
+    GetNames();
+    GetData(TRAIN ? ".data" : ".test");
+    printf("\nRead %d cases (%d attributes) from %s.%s\n",
+	   MaxItem+1, MaxAtt+1, FileName, (TRAIN ? "data" : "test"));
+
+    if (IGNOREMVCLASS == 1)
+      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
+    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
+      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
+
+
+    GetRules();
+
+    if ( TRACE )
+    {
+	ForEach(r, 1, NRules)
+	{
+	    PrintRule(r);
+	}
+	printf("\nDefault class: %s\n", ClassName[DefaultClass]);
+    }
+
+
+
+    printf("\nGenerate labels file from %s data (%d items):\n", 
+	   (TRAIN ? "training" : "test"), MaxItem+1);
+    
+    if (ModelSuffix == 0)
+      sprintf(suffixbuf,".labs");
+    else
+      sprintf(suffixbuf,"%s.labs",ModelSuffix);
+
+    Interp(suffixbuf);
+
+
+    exit(0);
+}
+
diff -Nu ../c45rel8/R8/Src/besttree.c ./besttree.c
--- ../c45rel8/R8/Src/besttree.c	Fri Feb 28 23:52:09 2003
+++ ./besttree.c	Fri Feb 28 23:52:09 2003
@@ -10,13 +10,14 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: besttree.c,v 1.5 1999/03/10 17:04:06 johann Exp $";
+
 
 ItemNo		*TargetClassFreq;
 Tree		*Raw;
 extern Tree	*Pruned;
 
 
-
 /*************************************************************************/
 /*									 */
 /*	Grow and prune a single tree from all data			 */
@@ -41,7 +42,7 @@
     printf("\n");
     PrintTree(Raw[0]);
 
-    SaveTree(Raw[0], ".unpruned");
+    SaveTree(Raw[0],".unpruned");
 
     Pruned[0] = CopyTree(Raw[0]);
     if ( Prune(Pruned[0]) )
diff -Nu ../c45rel8/R8/Src/build.c ./build.c
--- ../c45rel8/R8/Src/build.c	Fri Feb 28 23:52:09 2003
+++ ./build.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: build.c,v 1.4 1999/03/10 17:04:07 johann Exp $";
 
 ItemCount
 	*Weight,	/* Weight[i]  = current fraction of item i */
diff -Nu ../c45rel8/R8/Src/c4.5.1 ./c4.5.1
--- ../c45rel8/R8/Src/c4.5.1	Thu Jan  1 01:00:00 1970
+++ ./c4.5.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,209 @@
+.TH C4.5 1
+.SH NAME
+.PP
+c4.5 \- form a decision tree from a file of examples
+.SH SYNOPSIS
+.PP
+.B c4.5
+[ \fB-f\fR filestem ]
+[ \fB-u\fR ]
+[ \fB-s\fR ]
+[ \fB-p\fR ]
+[ \fB-v\fR verb ]
+[ \fB-t\fR trials ]
+   [ \fB-w\fR wsize ]
+[ \fB-i\fR incr ]
+[ \fB-g\fR ]
+[ \fB-m\fR minobjs ]
+[ \fB-c\fR cf ]
+.SH NOTE
+.PP
+For info on the additions and mdifications included in the OeFAI
+version of 
+.I C4.5
+please see
+.I man c4.5oefai
+.SH DESCRIPTION
+.PP
+.I C4.5
+is a program for inducing classification rules in the form
+of decision trees from a set of given examples.
+.PP
+All files read and written by C4.5 are of the form
+.I filestem.ext
+where
+.I filestem
+is a file name stem that identifies the induction task and
+.I ext
+is an extension that defines the type of file.
+The program expects to find at least 
+two files: a
+.B names file
+.I filestem.names
+defining class, attribute and attribute value names, and a
+.B data file
+.I filestem.data
+containing a set of objects, each of which is described by its
+values of each of the attributes and its class.
+.PP
+The program can generate trees
+in two ways.  In
+.I batch
+mode (the default), the program generates a single tree
+using all the available data.
+In
+.I iterative
+mode,
+the program starts with a randomly-selected subset of the
+data (the
+.I window),
+generates a trial decision tree, adds some misclassified
+objects, and continues until the trial decision tree
+correctly classifies all objects not in the window or
+until it appears that no progress is being made.
+Since iterative mode starts with a randomly-selected subset,
+multiple trials with the same data can be used to generate
+more than one tree.
+.PP
+All trees generated in the process are saved in
+.I filestem.unpruned.
+After each tree is generated, it is
+.I pruned
+in an attempt to simplify it.
+The `best' pruned tree (selected by the program if more there is
+more than one trial)
+is saved in machine-readable form in
+.I filestem.tree.
+.PP
+All trees produced, both pre- and post-simplification, are evaluated
+on the training data.  If required, they can also be evaluated
+on unseen data in file
+.I filestem.test.
+
+.SH FILE FORMATS
+The
+.B names file
+.I filestem.names
+is a series of entries defining names of attributes,
+attribute values and classes.  The file is free-format
+with the exception that the vertical bar `|' causes the
+remainder of that line to be ignored.
+Each entry is terminated by a period which may be
+omitted if it is the last character of a line.
+.PP
+The file
+commences with the names of the classes, separated by
+commas and terminated with a period.  Each name consists of
+a string of characters that does not include comma, question mark
+or colon (unless preceded by a backslash).  A period may be
+embedded in a name provided it is not followed by a space.
+Embedded spaces are also permitted but multiple whitespace is
+replaced by a single space.
+The rest of the file consists of a single entry for each
+attribute.  An attribute entry begins with the attribute name
+followed by a colon, and then either the word `ignore' (indicating
+that this attribute should not be used), the word `continuous'
+(indicating that the attribute has real values),
+the word `discrete' followed by an integer
+.I n
+(indicating that the program should assemble
+a list of up to
+.I n
+possible values), or a list
+of all possible discrete values separated by commas.  (The latter
+form for discrete attributes is recommended as it
+enables input to be checked.)  Each
+entry is terminated with a period (but see above).
+.PP
+The
+.B data file
+.I filestem.data
+contains one line per object.  Each line contains
+the values of the attributes in order followed by the
+object's class, with all entries separated by commas.
+The rules for valid names in the
+.B names file
+also hold for the names in the
+.B data file.
+An unknown value of an attribute is indicated by a
+question mark `?'.
+If a 
+.B test file
+.I filestem.test
+is used, it has the same format as the data file.
+
+.SH OPTIONS
+Options and their meanings are:
+.PP
+.TP 12
+.BI \-f filestem\^
+Specify the filename stem (default
+.B DF)
+.TP
+.B \-u
+Evaluate trees produced on unseen cases in file 
+.I filestem.test.
+.TP
+.B \-s
+Force `subsetting' of all tests based on discrete attributes
+with more than two values.  C4.5 will construct a test with
+a subset of values associated with each branch.
+.TP
+.B \-p
+Probabilistic thresholds used for continuous attributes (see Quinlan, 1987a).
+.TP
+.BI \-t trials\^
+Set iterative mode with specified number of trials.
+.TP
+.BI \-v verb\^
+Set the verbosity level [0-3] (default 0).
+This option generates more voluminous output that may help to
+explain what the program is doing (but don't count on it);
+see the manual entry for
+.I verbose.
+.PP
+The following options are also available but need not
+be used except for experimentation with tree construction:
+.TP 12
+.BI \-w wsize\^
+Set the size of the initial window
+(default is the maximum of 20 percent and twice the square
+root of the number of data objects).
+.TP
+.BI \-i incr\^
+Set the maximum number of objects that can be
+added to the window at each iteration
+(default is 20 percent of the initial window size).
+.TP
+.B \-g
+Use the gain criterion to select tests.  The default
+uses the gain ratio criterion.
+.TP
+.BI \-m minobjs\^
+In all tests, at least two branches must contain a minimum number
+of objects (default 2).  This option allows the minimum
+number to be altered.
+.TP
+.BI \-c cf\^
+Set the pruning confidence level (default 25%).
+.SH FILES
+.PP
+.in 8
+c4.5
+.br
+filestem.data
+.br
+filestem.names
+.br
+filestem.unpruned  (unpruned trees)
+.br
+filestem.tree   (final decision tree)
+.br
+filestem.test   (unseen data)
+.in 0
+.PP
+.SH SEE ALSO
+.PP
+c4.5oefai(1), c4.5showtree(1), bconsult(1), c4.5rules(1), consult(1)
+.PP
+.SH BUGS
diff -Nu ../c45rel8/R8/Src/c4.5.c ./c4.5.c
--- ../c45rel8/R8/Src/c4.5.c	Fri Feb 28 23:52:09 2003
+++ ./c4.5.c	Sat Mar 15 10:36:40 2003
@@ -5,14 +5,119 @@
 /*									 */
 /*************************************************************************/
 
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+// [c45oefai]
+//
+// = FILENAME
+//   c4.5.c
+//
+// = AUTHOR(S)
+//   J.R. Quinlan, modifications by Johann Petrak
+//
+// = TITLE
+//   OEFAI modifications and additions to the C4.5 program
+//
+// = DESCRIPTION
+//   This is the modified version of C4.5, release 8.
+//   The most important changes
+//   and additions to the original program are:
+// = BEGIN<NOFILL>
+//   - Added option -h to show a short summary of allowed options
+//   - Enhanced portability: now also compiles under DOS 
+//     (tested with CygWin32 and MSVC++ 5.0)
+//   - Added option -M to allow to handle several tree/rule files
+//     together with one data file (see arguments)
+//   - Added option -I to specify how to process missing values
+//     that occur in the target attribute
+//   - Added option -S that will suppress output of the trees
+//   - Added versioning for the sources - to determine the versions
+//     used for a binary use 'ident binfile' or 'what binfile'
+//   - Changed the internal representation for missing value of
+//     continuous fields from -999 to <FLT_MIN>
+//   - Slightly changed the way class confusion matrices are 
+//     printed: zero entries are printed as a zero, not
+//     being left blank as before.
+//   - Added the -O option to deliberately generate an unpruned 
+//     tree (which is written to the <.tree> file) 
+// = END<NOFILL>
+//
+// = SYNOPSIS
+//   c4.5  [-f\<fstem\>] [-b] [-u] [-p] [-v\<n\>] [-t\<n\>] [-w\<w\>] 
+//         [-i\<n\>] [-g] [-s] [-m\<n\>] [-c\<n\>] [-S] [-O]
+//         [-T\<n\>] [-M\<name\>] [-I\<n\>] [-h] 
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments 
+//   (defaults in parenteses):
+// = BEGIN<NOFILL>
+//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
+//   <-b>: windowing disabled (this is the default)
+//   <-u>: evaluate on unseens in <fstem>.test (no)
+//   <-p>: use probability thresholds (dont use)
+//   <-v\<n\>>: verbosity level (0)
+//   <-t\<n\>>: windowing with n trials (10 if enabled)
+//   <-w\<n\>>: windowing size (20percent of training if windowing enabled)
+//   <-i\<n\>>: windowing increment (20percent of training if windowing enabled)
+//   <-g>: use gain criterion (dont, use gain ratio)
+//   <-s>: use value subsets (dont)
+//   <-m\<n\>>: minimum cases in 2 different branches  (2)
+//   <-c\<n\>>: confidence (25)
+//   <-S>: suppress printing of trees (dont suppress)
+//   <-O>: overfit, do not prune (prune)
+//   <-T\<n\>>: Specify target attribute number (counting from 1).
+//       If this paramter is not give, the classic C4.5
+//       scheme is used: the last attribute in the data file
+//       contains the class label and the names file contains
+//       the list of allowed class labels as its first entry.
+//       If this parameter is given, any discrete attribute 
+//       in the data file can be used as class attribute.
+//       The names file must contain an attribute description
+//       entry for all attribues, and must not contain the
+//       initial entry describing the class labels (the class
+//       labels are now described in the corresponding attribute
+//       description entry)
+//   <-M\<name\>>: Add the given name to the filestem for the 
+//       files containing the trees (fstem.tree, fstem.unpruned).
+//   <-I\<n\>>: n=1: ignore records w/ MV in class
+//       n=2: substitute first class label  (treat as error)
+//   <-h>: Show help information about valid options
+//   
+// = END<NOFILL>
+//
+// = VERSION
+//   $Revision: 1.11 $
+//
+// = DATE
+//   $Date: 1999/03/16 16:37:44 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+ */
+
+
+
 
 #include "defns.i"
 #include "types.i"
 
+static char * rcsid = "@(#)$Id: c4.5.c,v 1.11 1999/03/16 16:37:44 johann Exp $";
 
-    /*  External data, described in extern.i  */
+    /*  External data, described in extern.i   */
 
 short		MaxAtt, MaxClass, MaxDiscrVal = 2;
+short           IGNOREMVCLASS  = 0;
+
+unsigned int NrMVClass = 0;
 
 ItemNo		MaxItem;
 
@@ -23,8 +128,10 @@
 char		*SpecialStatus;
 
 String		*ClassName,
+                *ClassAttr,
 		*AttName,
 		**AttValName,
+                ModelSuffix = 0;
 		FileName = "DF";
 
 short		VERBOSITY = 0,
@@ -34,11 +141,14 @@
 		SUBSET     = false,
 		BATCH      = true,
 		UNSEENS    = false,
-		PROBTHRESH = false;
+		PROBTHRESH = false,
+		PRINTTREE  = true,
+                PRUNETREE  = true;
 
 ItemNo		MINOBJS   = 2,
 		WINDOW    = 0,
-		INCREMENT = 0;
+                TARGETCOLUMN = 0,
+                INCREMENT = 0;
 
 float		CF = 0.25;
 
@@ -47,24 +157,27 @@
 Boolean		AllKnown = true;
 
 
+char suffixbuf[256];
+
+
     main(Argc, Argv)
 /*  ----  */
     int Argc;
     char *Argv[];
 {
-    int o;
+    int o;   
     extern char *optarg;
     extern int optind;
     Boolean FirstTime=true;
     short Best, BestTree();
 
-    PrintHeader("decision tree generator");
+    PrintHeader("(OFAI) decision tree generator");
 
     /*  Process options  */
 
-    while ( (o = getopt(Argc, Argv, "f:bupv:t:w:i:gsm:c:")) != EOF )
+    while ( (o = getopt(Argc, Argv, "f:bupv:t:w:i:gsm:c:SOT:I:hM:")) != EOF )
     {
-	if ( FirstTime )
+	if ( FirstTime && o != 'h')
 	{
 	    printf("\n    Options:\n");
 	    FirstTime = false;
@@ -75,6 +188,9 @@
 	case 'f':   FileName = optarg;
 		    printf("\tFile stem <%s>\n", FileName);
 		    break;
+	case 'M':   ModelSuffix = optarg;
+		    printf("\tModel name <%s>\n", ModelSuffix);
+		    break;
 	case 'b':   BATCH = true;
 		    printf("\tWindowing disabled (now the default)\n");
 		    break;
@@ -116,14 +232,60 @@
 		    break;
 	case 'c':   CF = atof(optarg);
 		    printf("\tPruning confidence level %g%%\n", CF);
-		    Check(CF, Epsilon, 100);
+		    Check(CF, 0, 100);
 		    CF /= 100;
 		    break;
-	case '?':   printf("unrecognised option\n");
+	case 'S':   PRINTTREE = false;
+		    printf("\tSuppress printing of decision tree(s)\n");
+		    break;
+	case 'O':   PRUNETREE = false;
+		    printf("\tSuppress pruning (Overfit)\n");
+		    break;
+	case 'T':   TARGETCOLUMN = atoi(optarg);
+		    printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		    break;
+	case 'I':   IGNOREMVCLASS = atoi(optarg);
+	            if (IGNOREMVCLASS == 0)
+		      printf("\tStandard handling of MVs as class values\n");
+		    else if  (IGNOREMVCLASS == 1)
+		      printf("\tIgnore cases with MV as class value\n");
+		    else if  (IGNOREMVCLASS == 2)
+		      printf("\tSubstitute first class label instead of MVs\n");
+		    else {
+		      printf("%s not a valid argument for option -I\n",optarg);
+		      exit(1);
+		    }
+		    break;
+	  case 'h': printf("usage: %s [options]\n", Argv[0]);
+	            printf("  options: [-f<fstem>] [-b] [-u] [-p] [-v<n>] [-t<n>] [-w<w>] [-i<n>]\n");
+		    printf("           [-g] [-s] [-m<n>] [-c<n>] [-S] [-O] [-T<n>] [-M<name>] [-I<n>] [-h]\n");
+		    printf("  -f<fstem>: filestem (DF)\n");
+		    printf("  -b:        windowing disabled (this is the default)\n");
+		    printf("  -u:        evaluate on unseens in <fstem>.test (false)\n");
+		    printf("  -p:        use probability thresholds (dont)\n");
+		    printf("  -v<n>:     verbosity level (0)\n");
+		    printf("  -t<n>:     windowing with n trials (10 if enabled)\n");
+		    printf("  -w<n>:     windowing size (20%% of training if windowing enabled)\n");
+		    printf("  -i<n>:     windowing increment (20%% of training if windowing enabled)\n");
+		    printf("  -g:        use gain criterion (dont, use gain ratio)\n");
+		    printf("  -s:        sue value subsets (dont)\n");
+		    printf("  -m<n>:     minimum cases in 2 branches  (2)\n");
+		    printf("  -c<n>:     confidence (25)\n");
+		    printf("  -S:        suppress printing of trees (dont suppress)\n");
+		    printf("  -O:        overfit, do not prune (prune)\n");
+		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
+		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
+		    printf("  -I<n>:     n=0: treat MV in class as error (default)\n");
+		    printf("             n=1: ignore records w/ MV in class\n");
+		    printf("             n=2: substitute first class label  (treat as error)\n");
+		    printf("  -h:        show this help info\n");
+		    exit(1);
+		    break;
+	case '?':   printf("unrecognised option (use -h for help)\n");
 		    exit(1);
 	}
     }
-
+    
     /*  Initialise  */
 
     GetNames();
@@ -131,8 +293,12 @@
     printf("\nRead %d cases (%d attributes) from %s.data\n",
 	   MaxItem+1, MaxAtt+1, FileName);
 
+    if (IGNOREMVCLASS == 1)
+      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
+    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
+      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
     /*  Build decision trees  */
-
+    
     if ( BATCH )
     {
 	TRIALS = 1;
diff -Nu ../c45rel8/R8/Src/c4.5oefai.1 ./c4.5oefai.1
--- ../c45rel8/R8/Src/c4.5oefai.1	Thu Jan  1 01:00:00 1970
+++ ./c4.5oefai.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,86 @@
+.ds sV Mar 16, 1999
+.ds sC c45oefai
+.ds sS 1
+.TH "\*(sC" "\*(sS" "\*(sV" "" ""
+.PP
+.SH "NAME"
+c45oefai \- 
+OEFAI modifications and additions to the C4.5 program
+.SH "SYNOPSIS"
+.nf
+\f(CO
+c4.5  [-f<fstem>] [-b] [-u] [-p] [-v<n>] [-t<n>] [-w<w>] 
+      [-i<n>] [-g] [-s] [-m<n>] [-c<n>] [-S] [-O]
+      [-T<n>] [-M<name>] [-I<n>] [-h] 
+\fP
+.fi
+.PP
+.SH "DESCRIPTION"
+This is the modified version of C4.5, release 8.
+The most important changes
+and additions to the original program are:
+.nf
+- Added option -h to show a short summary of allowed options
+- Enhanced portability: now also compiles under DOS 
+  (tested with CygWin32 and MSVC++ 5.0)
+- Added option -M to allow to handle several tree/rule files
+  together with one data file (see arguments)
+- Added option -I to specify how to process missing values
+  that occur in the target attribute
+- Added option -S that will suppress output of the trees
+- Added versioning for the sources - to determine the versions
+  used for a binary use 'ident binfile' or 'what binfile'
+- Changed the internal representation for missing value of
+  continuous fields from -999 to \f(COFLT_MIN\fP
+- Slightly changed the way class confusion matrices are 
+  printed: zero entries are printed as a zero, not
+  being left blank as before.
+- Added the -O option to deliberately generate an unpruned 
+  tree (which is written to the \f(CO.tree\fP file) 
+.fi
+.PP
+.SH "ARGUMENTS"
+The program takes the following command-line arguments 
+(defaults in parenteses):
+.nf
+\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
+\f(CO-b\fP: windowing disabled (this is the default)
+\f(CO-u\fP: evaluate on unseens in \f(COfstem\fP.test (no)
+\f(CO-p\fP: use probability thresholds (dont use)
+\f(CO-v<n>\fP: verbosity level (0)
+\f(CO-t<n>\fP: windowing with n trials (10 if enabled)
+\f(CO-w<n>\fP: windowing size (20percent of training if windowing enabled)
+\f(CO-i<n>\fP: windowing increment (20percent of training if windowing enabled)
+\f(CO-g\fP: use gain criterion (dont, use gain ratio)
+\f(CO-s\fP: use value subsets (dont)
+\f(CO-m<n>\fP: minimum cases in 2 different branches  (2)
+\f(CO-c<n>\fP: confidence (25)
+\f(CO-S\fP: suppress printing of trees (dont suppress)
+\f(CO-O\fP: overfit, do not prune (prune)
+\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
+    If this paramter is not give, the classic C4.5
+    scheme is used: the last attribute in the data file
+    contains the class label and the names file contains
+    the list of allowed class labels as its first entry.
+    If this parameter is given, any discrete attribute 
+    in the data file can be used as class attribute.
+    The names file must contain an attribute description
+    entry for all attribues, and must not contain the
+    initial entry describing the class labels (the class
+    labels are now described in the corresponding attribute
+    description entry)
+\f(CO-M<name>\fP: Add the given name to the filestem for the 
+    files containing the trees (fstem.tree, fstem.unpruned).
+\f(CO-I<n>\fP: n=1: ignore records w/ MV in class
+    n=2: substitute first class label  (treat as error)
+\f(CO-h\fP: Show help information about valid options
+.fi
+.PP
+.SH "DATE"
+$Date: 1999/03/10 19:55:12 $
+.PP
+.SH "VERSION"
+$Revision: 1.10 $
+.PP
+.SH "AUTHOR(S)"
+J.R. Quinlan, modifications by Johann Petrak
diff -Nu ../c45rel8/R8/Src/c4.5rules.1 ./c4.5rules.1
--- ../c45rel8/R8/Src/c4.5rules.1	Thu Jan  1 01:00:00 1970
+++ ./c4.5rules.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,109 @@
+.EN
+.TH C4.5 1
+.SH NAME
+.PP
+c4.5rules \- form production rules from unpruned decision trees
+.SH SYNOPSIS
+.PP
+.B c4.5rules
+[ \fB-f\fR filestem ]
+[ \fB-u\fR ]
+[ \fB-v\fR verb ]
+[ \fB-F\fR siglevel ]
+[ \fB-c\fR cf ]
+[ \fB-r\fR redundancy ]
+.SH NOTE
+.PP
+For info on the additions and mdifications included in the OeFAI
+version of 
+.I C4.5rules
+please see
+.I man c4.5rulesoefai
+.SH DESCRIPTION
+.PP
+.I C4.5rules 
+reads the decision tree or trees produced by C4.5 and generates
+a set of production rules from each tree and
+from all trees together.
+All files read and written by C4.5 are of the form
+.I filestem.ext
+where
+.I filestem
+is a file name stem that identifies the induction task and
+.I ext
+is an extension that defines the type of file.
+The Rules program
+expects to find a
+.B names file
+defining class, attribute and attribute value names, a
+.B data file
+containing a set of objects whose class and value of each
+attribute is specified, a
+.B unpruned file
+generated by C4.5 from the
+.B data file,
+and (optionally) a
+.B test file
+containing unseen objects.
+.PP
+For each tree that it finds, the program generates a set of
+pruned rules, and then sifts this set in an attempt to find
+the most useful subset of them.  If more than one tree was
+found, all subsets are then merged and the resulting composite
+set of rules is then sifted.  The final set of rules is saved
+in a machine-readable format in a
+.B rules
+file.
+Each of the rulesets produced is then evaluated on the
+original training data and (optionally) on the test data.
+.PP
+.SH OPTIONS
+.PP
+.TP 12
+.BI \-f filestem\^
+Specify the filename stem (default
+.B DF).
+.TP
+.B \-u
+Evaluate rulesets on unseen cases in file
+.I filestem.test.
+.TP
+.BI \-v verb\^
+Set the verbosity level [0-3] (default 0).
+.TP
+.BI \-F siglevel\^
+Invoke Fisher's significance test when pruning rules.
+If a rule contains a condition whose probability of being irrelevant
+is greater than the stated level, the rule is pruned further
+(default: no significance testing).
+.TP
+.BI \-c cf\^
+Set the confidence level used in forming the pessimistic
+estimate of a rule's error rate (default 25%).
+.TP
+.BI \-r redundancy\^
+If many irrelevant or redundant attributes are included, estimate
+the ratio of attributes to ``sensible'' attributes (default 1).
+.PP
+.SH FILES
+.PP
+.in 8
+c4.5
+.br
+c4.5rules
+.br
+filestem.data
+.br
+filestem.names
+.br
+filestem.unpruned  (unpruned trees)
+.br
+filestem.rules  (production rules)
+.br
+filestem.test   (unseen data)
+.in 0
+.PP
+.SH SEE ALSO
+.PP
+c4.5(1), consultr(1)
+.SH BUGS
diff -Nu ../c45rel8/R8/Src/c4.5rules.c ./c4.5rules.c
--- ../c45rel8/R8/Src/c4.5rules.c	Fri Feb 28 23:52:09 2003
+++ ./c4.5rules.c	Fri Feb 28 23:52:09 2003
@@ -5,17 +5,102 @@
 /*									 */
 /*************************************************************************/
 
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+// [c45rulesoefai]
+//
+// = FILENAME
+//   c4.5rules.c
+//
+// = TITLE
+//   OEFAI modifications and additions to the C4.5rule program
+//
+// = AUTHOR(S)
+//   J.R. Quinlan, modifications and additions by Johann Petrak
+//
+// = DESCRIPTION
+//   This is the modified version of C4.5, release 8.
+//   The most important changes
+//   and additions to the original program are:
+// = BEGIN<NOFILL>
+//   - Added option -h to show a short summary of allowed options
+//   - Enhanced portability: now also compiles under DOS 
+//     (tested with CygWin32 and MSVC++ 5.0)
+//   - Added options -M, -I, -T, -S: see c4.5
+// = END<NOFILL>
+//
+// = SYNOPSIS
+//   c4.5  [-f\<fstem\>] [-u] [-r\<n\>] [-v\<n\>] [-F\<n\>] [-c\<n\>]
+//    [-s]  [-S] [-T\<n\>] [-M\<name\>] [-I\<n\>] [-h] 
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments 
+//   (defaults in parenteses):
+// = BEGIN<NOFILL>
+//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
+//   <-u>: evaluate on unseens in <fstem>.test (no)
+//   <-r\<n\>>: redundancy factor (1.0)
+//   <-v\<n\>>: verbosity level (0)
+//   <-F\<n\>>: exact Fisher test significance level
+//       (don't use exact Fisher test)
+//   <-c\<n\>>: pruning confidence (25\%)
+//   <-S>: suppress printing of trees (dont suppress)
+//   <-T\<n\>>: Specify target attribute number (counting from 1).
+//       If this paramter is not give, the classic C4.5
+//       scheme is used: the last attribute in the data file
+//       contains the class label and the names file contains
+//       the list of allowed class labels as its first entry.
+//       If this parameter is given, any discrete attribute 
+//       in the data file can be used as class attribute.
+//       The names file must contain an attribute description
+//       entry for all attribues, and must not contain the
+//       initial entry describing the class labels (the class
+//       labels are now described in the corresponding attribute
+//       description entry)
+//   <-M\<name\>>: Add the given name to the filestem for the 
+//       files containing the trees (fstem.tree, fstem.unpruned).
+//   <-I\<n\>>: n=1: ignore records w/ MV in class
+//       n=2: substitute first class label  (treat as error)
+//   <-h>: Show help information about valid options
+//   
+// = END<NOFILL>
+//
+// = VERSION
+//   $Revision: 1.10 $
+//
+// = DATE
+//   $Date: 1999/03/16 16:37:45 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+
+ */
+
+
 
 #include "defns.i"
 #include "types.i"
 
+static char * rcsid = "@(#)$Id: c4.5rules.c,v 1.10 1999/03/16 16:37:45 johann Exp $";
 
 	/*  External data.  Note: uncommented variables have the same meaning
 	    as for decision trees  */
 
+unsigned int NrMVClass = 0;
+
 short		MaxAtt, MaxClass, MaxDiscrVal;
 
-ItemNo		MaxItem;
+ItemNo		MaxItem,
+                TARGETCOLUMN = 0;
 
 Description	*Item;
 
@@ -24,15 +109,19 @@
 char		*SpecialStatus;
 
 String		*ClassName,
+                *ClassAttr,
 		*AttName,
 		**AttValName,
+                ModelSuffix = 0;
 		FileName = "DF";
 
 short		VERBOSITY = 0,
+                IGNOREMVCLASS = 0,
 		TRIALS;
 
 Boolean		UNSEENS	  = false,
 		SIGTEST	  = false,	/* use significance test in rule pruning */
+		PRINTTREE = true,       /* print decision trees/rules */
 		SIMANNEAL = false;	/* use simulated annealing */
 
 float		SIGTHRESH   = 0.05,
@@ -55,6 +144,7 @@
 float		AttTestBits,		/* bits to encode tested att */
 		*BranchBits;		/* ditto attribute value */
 
+char suffixbuf[256];
 
 
     main(Argc, Argv)
@@ -67,11 +157,11 @@
     extern int optind;
     Boolean FirstTime=true;
 
-    PrintHeader("rule generator");
+    PrintHeader("(OFAI) rule generator");
 
     /*  Process options  */
 
-    while ( (o = getopt(Argc, Argv, "f:uv:c:r:F:a")) != EOF )
+    while ( (o = getopt(Argc, Argv, "f:uv:c:r:F:aT:I:M:Sh")) != EOF )
     {
 	if ( FirstTime )
 	{
@@ -84,6 +174,9 @@
 	    case 'f':	FileName = optarg;
 			printf("\tFile stem <%s>\n", FileName);
 			break;
+	    case 'M':   ModelSuffix = optarg;
+	                printf("\tModel name <%s>\n", ModelSuffix);
+		        break;
 	    case 'u':	UNSEENS = true;
 			printf("\tRulesets evaluated on unseen cases\n");
 			break;
@@ -109,6 +202,41 @@
 	    case 'a':	SIMANNEAL = true;
 			printf("\tSimulated annealing for selecting rules\n");
 			break;
+	    case 'S':	PRINTTREE = false;
+			printf("\tSuppress printing of rules\n");
+			break;
+	    case 'T':   TARGETCOLUMN = atoi(optarg);
+	                printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+	                break;
+	  case 'I':   IGNOREMVCLASS = atoi(optarg);
+	              if (IGNOREMVCLASS == 0)
+			printf("\tStandard handling of MVs as class values\n");
+		      else if  (IGNOREMVCLASS == 1)
+			printf("\tIgnore cases with MV as class value\n");
+		      else if  (IGNOREMVCLASS == 2)
+			printf("\tSubstitute first class label instead of MVs\n");
+		      else {
+			printf("%s not a valid argument for option -I\n",optarg);
+			exit(1);
+		      }
+		      break;
+	  case 'h': printf("usage: %s [options]\n", Argv[0]);
+	            printf("  options: [-f<fstem>] [-u] [-r<n>] [-v<n>]\n");
+		    printf("           [-c<n>] [-S] [-T<n>] [-M<name>] [-I<n>] [-h]\n");
+		    printf("  -f<fstem>: filestem (DF)\n");
+		    printf("  -r<n>:     redundancy factor (1.0)\n");
+		    printf("  -u:        evaluate on unseens in <fstem>.test (false)\n");
+		    printf("  -F<n>:     exact test significance level (dont use)\n");
+		    printf("  -v<n>:     verbosity level (0)\n");
+		    printf("  -c<n>:     pruning confidence (25)\n");
+		    printf("  -S:        suppress printing of rules (dont suppress)\n");
+		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
+		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
+		    printf("  -I<n>:     n=1: ignore records w/ MV in class\n");
+		    printf("             n=2: substitute first class label  (treat as error)\n");
+		    printf("  -h:        show this help info\n");
+		    exit(1);
+		    break;
 	    case '?':	printf("unrecognised option\n");
 			exit(1);
 	}
@@ -120,6 +248,10 @@
     GetData(".data");
     printf("\nRead %d cases (%d attributes) from %s\n",
 	   MaxItem+1, MaxAtt+1, FileName);
+    if (IGNOREMVCLASS == 1)
+      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
+    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
+      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
 
     GenerateLogs();
 
diff -Nu ../c45rel8/R8/Src/c4.5rulesoefai.1 ./c4.5rulesoefai.1
--- ../c45rel8/R8/Src/c4.5rulesoefai.1	Thu Jan  1 01:00:00 1970
+++ ./c4.5rulesoefai.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,72 @@
+.\" troff -man %
+.\"
+.\" DO NOT EDIT
+.\"
+.\" This manual page is automatically generated by class2man.
+.\"
+.ds sV Mar 16, 1999
+.ds sC c45rulesoefai
+.ds sS 1
+.TH "\*(sC" "\*(sS" "\*(sV" "" ""
+.PP
+.SH "NAME"
+c45rulesoefai \- 
+OEFAI modifications and additions to the C4.5rule program
+.SH "SYNOPSIS"
+.nf
+\f(CO
+c4.5  [-f<fstem>] [-u] [-r<n>] [-v<n>] [-F<n>] [-c<n>]
+ [-s]  [-S] [-T<n>] [-M<name>] [-I<n>] [-h] 
+\fP
+.fi
+.PP
+.SH "DESCRIPTION"
+This is the modified version of C4.5, release 8.
+The most important changes
+and additions to the original program are:
+.nf
+- Added option -h to show a short summary of allowed options
+- Enhanced portability: now also compiles under DOS 
+  (tested with CygWin32 and MSVC++ 5.0)
+- Added options -M, -I, -T, -S: see c4.5
+.fi
+.PP
+.SH "ARGUMENTS"
+The program takes the following command-line arguments 
+(defaults in parenteses):
+.nf
+\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
+\f(CO-u\fP: evaluate on unseens in \f(COfstem\fP.test (no)
+\f(CO-r<n>\fP: redundancy factor (1.0)
+\f(CO-v<n>\fP: verbosity level (0)
+\f(CO-F<n>\fP: exact Fisher test significance level
+    (don't use exact Fisher test)
+\f(CO-c<n>\fP: pruning confidence (25\\%)
+\f(CO-S\fP: suppress printing of trees (dont suppress)
+\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
+    If this paramter is not give, the classic C4.5
+    scheme is used: the last attribute in the data file
+    contains the class label and the names file contains
+    the list of allowed class labels as its first entry.
+    If this parameter is given, any discrete attribute 
+    in the data file can be used as class attribute.
+    The names file must contain an attribute description
+    entry for all attribues, and must not contain the
+    initial entry describing the class labels (the class
+    labels are now described in the corresponding attribute
+    description entry)
+\f(CO-M<name>\fP: Add the given name to the filestem for the 
+    files containing the trees (fstem.tree, fstem.unpruned).
+\f(CO-I<n>\fP: n=1: ignore records w/ MV in class
+    n=2: substitute first class label  (treat as error)
+\f(CO-h\fP: Show help information about valid options
+.fi
+.PP
+.SH "DATE"
+$Date: 1999/03/10 19:55:14 $
+.PP
+.SH "VERSION"
+$Revision: 1.9 $
+.PP
+.SH "AUTHOR(S)"
+J.R. Quinlan, modifications and additions by Johann Petrak
diff -Nu ../c45rel8/R8/Src/c4.5showrules.1 ./c4.5showrules.1
--- ../c45rel8/R8/Src/c4.5showrules.1	Thu Jan  1 01:00:00 1970
+++ ./c4.5showrules.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,66 @@
+.\" troff -man %
+.\"
+.\" DO NOT EDIT
+.\"
+.\" This manual page is automatically generated by class2man.
+.\"
+.ds sV Mar 16, 1999
+.ds sC c45showrules
+.ds sS 1
+.TH "\*(sC" "\*(sS" "\*(sV" "" ""
+.PP
+.SH "NAME"
+c45showrules \- 
+Show C4.5 rules and associated instances
+.SH "SYNOPSIS"
+.nf
+\f(CO
+c4.5showrules  [-f<fstem>] [-c] [-u] [-M<name>] [-U] [-T<n>] [-h]
+\fP
+.fi
+.PP
+.SH "DESCRIPTION"
+This program can be used to print rules that were
+previously generated with the c4.5rules program and optionally
+include additional information like 
+node local instance numbers in the printout.
+.PP
+.SH "ARGUMENTS"
+The program takes the following command-line arguments:
+.nf
+\f(CO-f<fstem>\fP: Filestem of data/names file to use (as with c4.5)
+\f(CO-c\fP: Show instance indices (case numbers). This will
+    generate an additional line starting with a hash symbol
+    after each terminal node printed. This line will contain
+    a blank seperated list of case numbers (counting from 0)
+    that go into that node.
+\f(CO-u\fP: Use test data (fstem.test) instead of training data
+    (fstem.data)
+\f(CO-M<name>\fP: Add the given name to the filestem for the 
+    files containing the rules (fstem.rules)
+    and the file that will contain the class labels
+    (fstem.labs)  (default: empty)
+\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
+    If this paramter is not give, the classic C4.5
+    scheme is used: the last attribute in the data file
+    contains the class label and the names file contains
+    the list of allowed class labels as its first entry.
+    If this parameter is given, any discrete attribute 
+    in the data file can be used as class attribute.
+    The names file must contain an attribute description
+    entry for all attribues, and must not contain the
+    initial entry describing the class labels (the class
+    labels are now described in the corresponding attribute
+    description entry)
+\f(CO-h\fP: Show help information about valid options
+.fi
+.PP
+.SH "DATE"
+$Date: 1999/03/10 19:55:15 $
+.PP
+.SH "VERSION"
+$Revision: 1.8 $
+.PP
+.SH "AUTHOR(S)"
+Johann Petrak using big portions of the original code by 
+J.R. Quinlan
diff -Nu ../c45rel8/R8/Src/c4.5showrules.c ./c4.5showrules.c
--- ../c45rel8/R8/Src/c4.5showrules.c	Thu Jan  1 01:00:00 1970
+++ ./c4.5showrules.c	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,328 @@
+/*************************************************************************/
+/*									 */
+/*  Generate labels for test cases using pre-generated rules     	 */
+/*  -----------------------------------------------------------------	 */
+/*									 */
+/*************************************************************************/
+
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+// [c45showrules]
+//
+// = FILENAME
+//   c45showrules.c
+//
+// = AUTHOR(S)
+//   Johann Petrak using big portions of the original code by 
+//   J.R. Quinlan
+//
+// = TITLE
+//   Show C4.5 rules and associated instances
+//
+// = DESCRIPTION
+//   This program can be used to print rules that were
+//   previously generated with the c4.5rules program and optionally
+//   include additional information like 
+//   node local instance numbers in the printout.
+//
+// = SYNOPSIS
+//   c4.5showrules  [-f\<fstem\>] [-c] [-u] [-M\<name\>] [-U] [-T\<n\>] [-h]
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments:
+// = BEGIN<NOFILL>
+//   <-f\<fstem\>>: Filestem of data/names file to use (as with c4.5)
+//   <-c>: Show instance indices (case numbers). This will
+//       generate an additional line starting with a hash symbol
+//       after each terminal node printed. This line will contain
+//       a blank seperated list of case numbers (counting from 0)
+//       that go into that node.
+//   <-u>: Use test data (fstem.test) instead of training data
+//       (fstem.data)
+//   <-M\<name\>>: Add the given name to the filestem for the 
+//       files containing the rules (fstem.rules)
+//       and the file that will contain the class labels
+//       (fstem.labs)  (default: empty)
+//   <-T\<n\>>: Specify target attribute number (counting from 1).
+//       If this paramter is not give, the classic C4.5
+//       scheme is used: the last attribute in the data file
+//       contains the class label and the names file contains
+//       the list of allowed class labels as its first entry.
+//       If this parameter is given, any discrete attribute 
+//       in the data file can be used as class attribute.
+//       The names file must contain an attribute description
+//       entry for all attribues, and must not contain the
+//       initial entry describing the class labels (the class
+//       labels are now described in the corresponding attribute
+//       description entry)
+//   <-h>: Show help information about valid options
+//   
+// = END<NOFILL>
+//
+// = VERSION
+//   $Revision: 1.9 $
+//
+// = DATE
+//   $Date: 1999/03/16 16:37:46 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+ */
+
+
+
+#include "defns.i"
+#include "types.i"
+
+static char * rcsid = "@(#)$Id: c4.5showrules.c,v 1.9 1999/03/16 16:37:46 johann Exp $";
+
+	/*  External data.  Note: uncommented variables have the same meaning
+	    as for decision trees  */
+
+Boolean         PRINTCASES = false;
+Boolean         USETEST = false;
+
+
+short		MaxAtt, MaxClass, MaxDiscrVal,
+                IGNOREMVCLASS = 0;
+
+ItemNo		MaxItem, TARGETCOLUMN = 0;
+
+Description	*Item;
+
+DiscrValue	*MaxAttVal;
+
+char		*SpecialStatus;
+
+String		*ClassName,
+                *ClassAttr,
+		*AttName,
+		**AttValName,
+                ModelSuffix = 0,
+		FileName = "DF";
+
+short		VERBOSITY = 0,
+		TRIALS;
+
+Boolean		TRACE	  = false;
+
+Boolean         PRINTTREE = true;
+
+Boolean		UNSEENS	  = false,
+		SIGTEST	  = false,	/* use significance test in rule pruning */
+		SIMANNEAL = false;	/* use simulated annealing */
+
+float		SIGTHRESH   = 0.05,
+		CF	    = 0.25,
+		REDUNDANCY  = 1.0;	/* factor that guesstimates the
+					   amount of redundancy and
+					   irrelevance in the attributes */
+
+PR		*Rule;			/* current rules */
+
+RuleNo		NRules = 0,		/* number of current rules */
+		*RuleIndex;		/* rule index */
+
+short		RuleSpace = 0;		/* space allocated for rules */
+
+ClassNo		DefaultClass;		/* current default class */
+
+RuleSet		*PRSet;			/* sets of rulesets */
+
+float		AttTestBits,		/* bits to encode tested att */
+		*BranchBits;		/* ditto attribute value */
+
+
+char suffixbuf[256];
+
+float	Confidence;		/* certainty factor of fired rule */
+				/* (set by BestRuleInd) */
+
+void MyPrintRule(RuleNo r);
+void MyPrintCondition(Condition c);
+
+
+
+RuleNo BestRuleInd(CaseDesc, Start)
+/*     ---------------  */
+    Description CaseDesc;
+    RuleNo Start;
+{
+    RuleNo r, ri;
+    float Strength();
+
+    ForEach(ri, Start, NRules)
+    {
+        Confidence = Strength(Rule[ri], CaseDesc);
+
+        if ( Confidence > 0.1 )
+        {
+            return ri;
+        }
+    }
+
+    Confidence = 0.0;
+    return 0;
+}
+
+/*************************************************************************/
+/*								  	 */
+/*		Print the current indexed ruleset		  	 */
+/*								  	 */
+/*************************************************************************/
+
+
+void MyPrintRules()
+{
+  short ri;
+  ItemNo i;
+
+  ForEach(ri, 1, NRules )
+    {
+      MyPrintRule(ri);
+    }
+  printf("\nDefault class: %s\n", ClassName[DefaultClass]);
+  if (PRINTCASES)
+  {
+    printf("# ");
+    ForEach(i, 0, MaxItem)
+      {
+	if  (0==BestRuleInd(Item[i], 1))
+	  printf("%d ",i);
+      }
+    printf("\n");
+  }
+}
+
+
+
+/*************************************************************************/
+/*								  	 */
+/*		Print the rule r				  	 */
+/*								  	 */
+/*************************************************************************/
+
+
+void MyPrintRule(r)
+  RuleNo r;
+{
+  ItemNo i;
+  short d;
+  RuleNo ri;
+
+  printf("\nRule %d:\n", r);
+  ForEach(d, 1, Rule[r].Size)
+    {
+      printf("    ");
+      PrintCondition(Rule[r].Lhs[d]);
+    }
+  printf("\t->  class %s  [%.1f%%]\n",
+	 ClassName[Rule[r].Rhs], 100 * (1 - Rule[r].Error)
+	 );
+  /* now print all case numbers covered by the preceding rule */
+  if (PRINTCASES)
+  {
+    printf("# ");
+    ForEach(i, 0, MaxItem)
+      {
+	if  (r==BestRuleInd(Item[i], 1))
+	  printf("%d ",i);
+      }
+    printf("\n");
+  }
+}
+
+
+int main(Argc, Argv)
+/*  ----  */
+  int Argc;
+char *Argv[];
+{
+  int o;
+  extern char *optarg;
+  extern int optind;
+  Boolean FirstTime=true;
+  int r;
+  
+  PrintHeader("Rule display");
+  
+  /*  Process options  */
+  
+  while ( (o = getopt(Argc, Argv, "f:cuT:M:h")) != EOF )
+  {
+    if ( FirstTime )
+    {
+      printf("\n    Options:\n");
+      FirstTime = false;
+    }
+    
+    switch (o)
+    {
+      case 'f':	FileName = optarg;
+      printf("\tFile stem <%s>\n", FileName);
+      break;
+      case 'M':   ModelSuffix = optarg;
+      printf("\tModel name <%s>\n", ModelSuffix);
+      break;
+      case 'c':   PRINTCASES = true;
+      printf("\toption -c: Print cases\n");
+      break;
+      case 'u':   USETEST = true;
+      printf("\toption -u: Use testset\n");
+      break; 
+      case 'T':   TARGETCOLUMN = atoi(optarg);
+      printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+      break;
+            case 'h':   printf("usage: %s [-c] [-u] -T<n> -M<name> -f<stem>\n",Argv[0]);
+			printf("  -c: Cases: show instance numbers\n");
+			printf("  -u: use test data instead of training data\n");
+			printf("  -f<xxxx>: specify file stem\n");
+			printf("  -T n: use attribute n (1..max) as target\n");
+			printf("  -M<name>: use <fstem><name>.tree/unpruned\n");
+			printf("  -h: show this help\n");
+                        exit(0);
+      case '?':	printf("unrecognised option\n");
+      exit(1);
+    }
+  } 
+  
+  printf("options processed!\n");
+  /*  Initialise  */
+  
+  GetNames();
+  printf("Names file read!\n");
+  
+  if (PRINTCASES)
+    if (USETEST)
+    {
+      printf("Reading test data!\n");
+      GetData(".test");
+      printf("\nRead %d cases (%d attributes) from %s.test\n",
+	     MaxItem+1, MaxAtt+1, FileName);
+    } else {
+      printf("Reading data!\n");
+      GetData(".data");
+      printf("\nRead %d cases (%d attributes) from %s.data\n",
+	     MaxItem+1, MaxAtt+1, FileName);
+    }
+  
+  GetRules();
+  printf("Rules file read!\n");
+  
+  
+  printf("Printing rules ...!\n");
+  MyPrintRules();
+  
+  
+  return(0);
+}
+
diff -Nu ../c45rel8/R8/Src/c4.5showtree.1 ./c4.5showtree.1
--- ../c45rel8/R8/Src/c4.5showtree.1	Thu Jan  1 01:00:00 1970
+++ ./c4.5showtree.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,74 @@
+.\" troff -man %
+.\"
+.\" DO NOT EDIT
+.\"
+.\" This manual page is automatically generated by class2man.
+.\"
+.ds sV Mar 16, 1999
+.ds sC c45showtree
+.ds sS 1
+.TH "\*(sC" "\*(sS" "\*(sV" "" ""
+.PP
+.SH "NAME"
+c45showtree \- 
+Show C4.5 trees and node-associated information and instances
+.SH "SYNOPSIS"
+.nf
+\f(CO
+c4.5showtree  [-f<fstem>]  [-v] [-w] [-c] [-u] [-M<name>] 
+              [-t<n>] [-U] [-T<n>] [-h]
+\fP
+.fi
+.PP
+.SH "DESCRIPTION"
+This program can be used to print a decision tree that was
+previously generated with the c4.5 program and optionally
+include additional information like node-local class distributions
+and node local instance numbers in the printout.
+.PP
+.SH "ARGUMENTS"
+The program takes the following command-line arguments:
+.nf
+\f(CO-f<fstem>\fP: Filestem of data/names file to use (as with c4.5)
+\f(CO-v<n>\fP: Verbosity level (default: 0)
+\f(CO-w\fP: Show instance weights with the instance indices.
+    The wights will be added after a seperating slash
+    to each index number.
+\f(CO-c\fP: Show instance indices (case numbers). This will
+    generate an additional line starting with a hash symbol
+    after each terminal node printed. This line will contain
+    a blank seperated list of case numbers (counting from 0)
+    that go into that node.
+\f(CO-u\fP: Use test data (fstem.test) instead of training data
+    (fstem.data)
+\f(CO-U\fP: Use unpruned tree (fstem.unpruned) instead of 
+    pruned one (fstem.tree)
+\f(CO-M<name>\fP: Add the given name to the filestem for the 
+    files containing the rules (fstem.rules)
+    and the file that will contain the class labels
+    (fstem.labs)  (default: empty)
+\f(CO-t<n>\fP: Use the tree from trial n (after windowing)
+\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
+    If this paramter is not give, the classic C4.5
+    scheme is used: the last attribute in the data file
+    contains the class label and the names file contains
+    the list of allowed class labels as its first entry.
+    If this parameter is given, any discrete attribute 
+    in the data file can be used as class attribute.
+    The names file must contain an attribute description
+    entry for all attribues, and must not contain the
+    initial entry describing the class labels (the class
+    labels are now described in the corresponding attribute
+    description entry)
+\f(CO-h\fP: Show help information about valid options
+.fi
+.PP
+.SH "DATE"
+$Date: 1999/03/10 19:55:16 $
+.PP
+.SH "VERSION"
+$Revision: 1.7 $
+.PP
+.SH "AUTHOR(S)"
+Johann Petrak using big portions of the original code by 
+J.R. Quinlan
diff -Nu ../c45rel8/R8/Src/c4.5showtree.c ./c4.5showtree.c
--- ../c45rel8/R8/Src/c4.5showtree.c	Thu Jan  1 01:00:00 1970
+++ ./c4.5showtree.c	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,575 @@
+/*************************************************************************/
+   /*								   	
+    print a C4.5 decision tree
+    quick hack by JP from the original consult.c and trees.c programs
+    */
+/*								   	 */
+/*************************************************************************/
+
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+// [c45showtree]
+//
+// = FILENAME
+//   c4.5showtree.c
+//
+// = AUTHOR(S)
+//   Johann Petrak using big portions of the original code by 
+//   J.R. Quinlan
+//
+// = TITLE
+//   Show C4.5 trees and node-associated information and instances
+//
+// = DESCRIPTION
+//   This program can be used to print a decision tree that was
+//   previously generated with the c4.5 program and optionally
+//   include additional information like node-local class distributions
+//   and node local instance numbers in the printout.
+//
+// = SYNOPSIS
+//   c4.5showtree  [-f\<fstem\>]  [-v] [-w] [-c] [-u] [-M\<name\>] 
+//                 [-t\<n\>] [-U] [-T\<n\>] [-h]
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments:
+// = BEGIN<NOFILL>
+//   <-f\<fstem\>>: Filestem of data/names file to use (as with c4.5)
+//   <-v\<n\>>: Verbosity level (default: 0)
+//   <-w>: Show instance weights with the instance indices.
+//       The wights will be added after a seperating slash
+//       to each index number.
+//   <-c>: Show instance indices (case numbers). This will
+//       generate an additional line starting with a hash symbol
+//       after each terminal node printed. This line will contain
+//       a blank seperated list of case numbers (counting from 0)
+//       that go into that node.
+//   <-u>: Use test data (fstem.test) instead of training data
+//       (fstem.data)
+//   <-U>: Use unpruned tree (fstem.unpruned) instead of 
+//       pruned one (fstem.tree)
+//   <-M\<name\>>: Add the given name to the filestem for the 
+//       files containing the rules (fstem.rules)
+//       and the file that will contain the class labels
+//       (fstem.labs)  (default: empty)
+//   <-t\<n\>>: Use the tree from trial n (after windowing)
+//   <-T\<n\>>: Specify target attribute number (counting from 1).
+//       If this paramter is not give, the classic C4.5
+//       scheme is used: the last attribute in the data file
+//       contains the class label and the names file contains
+//       the list of allowed class labels as its first entry.
+//       If this parameter is given, any discrete attribute 
+//       in the data file can be used as class attribute.
+//       The names file must contain an attribute description
+//       entry for all attribues, and must not contain the
+//       initial entry describing the class labels (the class
+//       labels are now described in the corresponding attribute
+//       description entry)
+//   <-h>: Show help information about valid options
+//   
+// = END<NOFILL>
+//
+// = VERSION
+//   $Revision: 1.8 $
+//
+// = DATE
+//   $Date: 1999/03/16 16:37:47 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+ */
+
+
+#include<stdlib.h>
+#include<stdio.h>
+
+#include "defns.i"
+#include "types.i"
+#include "extern.i"
+
+static char * rcsid = "@(#)$Id: c4.5showtree.c,v 1.8 1999/03/16 16:37:47 johann Exp $";
+
+
+#define	Tab		"| "
+#define	TabSize		2
+#define	Width		8000	/* approx max width of printed trees */
+
+String format;
+ 
+short		MaxAtt, MaxClass, MaxDiscrVal,
+                IGNOREMVCLASS = 0;
+
+ItemNo		MaxItem, TARGETCOLUMN = 0;
+
+short           NumberTrial = 0;
+
+Description	*Item;
+
+DiscrValue	*MaxAttVal;
+
+String		*ClassName,
+                *ClassAttr,
+		*AttName,
+		**AttValName,
+                ModelSuffix = 0,
+		FileName = "DF";
+
+
+Boolean		UNPRUNED = false;
+Boolean		VERBOSE = false;
+Boolean		PRINTCASES = false;
+Boolean		PRINTWEIGHTS = false;
+Boolean         USETEST = false;
+
+char		*SpecialStatus;
+
+Boolean         PRINTTREE = true;
+
+typedef	struct ValRange *RangeDescRec;
+
+
+RangeDescRec RangeDesc;
+
+
+Tree	DecisionTree,			/* tree being used */
+	GetTree();
+
+char suffixbuf[256];
+
+void MyShowBranch(short Sh, Tree T, DiscrValue v);
+void MyIndent(short Sh, char * Mark);
+void MyShow(Tree T, short Sh);
+
+/*************************************************************************/
+/*  check if DT - node is reached for a case descritpion                 */
+/*  if no, return 0.0, otherwise return the case weight                  */
+/*************************************************************************/
+
+float getWeight(T,Node,CaseDesc,Weight,found)
+  Tree T;
+  Tree Node;
+  Description * CaseDesc;
+  float Weight;
+  Boolean * found;
+{
+    float weight;
+    DiscrValue v, dv;
+    float Cv;
+    Attribute a;
+
+  switch(T->NodeType)
+  {
+    case 0:
+    if (T==Node) 
+    {
+      *found = true;
+      return Weight;
+    } else {
+      *found = false;
+      return 0.0;
+    }
+    break;
+    case BrDiscr:
+    a = T->Tested;
+    v = DVal((*CaseDesc), a);
+    if ( v && v <= T->Forks )	/*  Make sure not new discrete value  */
+    {
+      return getWeight(T->Branch[v],Node,CaseDesc,Weight,found);
+    }
+    else
+    {
+      ForEach(v, 1, T->Forks)
+	{
+	  weight = getWeight(T->Branch[v], Node, CaseDesc, 
+			     (Weight * T->Branch[v]->Items) / T->Items,found);
+	  if (*found) return weight;
+	}
+    }
+    break;
+    case ThreshContin:  /* test of continuous attribute */
+    
+    a = T->Tested;
+    Cv = CVal((*CaseDesc), a);
+    
+    if ( Cv == Unknown )
+    {
+      ForEach(v, 1, 2)
+	{
+	  weight = getWeight(T->Branch[v], Node, CaseDesc,
+			     (Weight * T->Branch[v]->Items) / T->Items,found);
+	  if (*found) return weight;
+	}
+    }
+    else
+    {
+      v = ( Cv <= T->Cut ? 1 : 2 );
+      return getWeight(T->Branch[v], Node, CaseDesc, Weight, found);
+    }
+    break;
+
+    case BrSubset:  /* subset test on discrete attribute  */
+    
+    a = T->Tested;
+    dv = DVal((*CaseDesc), a);
+    
+    if ( dv )
+    {
+      ForEach(v, 1, T->Forks)
+	if ( In(dv, T->Subset[v]) )
+	  return  getWeight(T->Branch[v], Node, CaseDesc, Weight, found);
+    }
+
+    /*  Value unknown or not found in any of the subsets  */
+    
+    ForEach(v, 1, T->Forks)
+      {
+	weight = getWeight(T->Branch[v], Node, CaseDesc, 
+			   (Weight * T->Branch[v]->Items) / T->Items, found);
+	if (*found) return weight;
+      }
+    break;
+  }
+  *found = false;
+  return 0.0;
+}
+
+
+/*************************************************************************/
+/*									 */
+/*	Display entire decision tree T					 */
+/*									 */
+/*************************************************************************/
+
+
+void  MyPrintTree(T)
+/*  ----------  */
+Tree T;
+{
+  
+  printf("Decision Tree:\n");
+  
+  MyShow(T, 0);
+  printf("\n");
+  
+}
+
+
+/*************************************************************************/
+/*									 */
+/*	Display the tree T with offset Sh				 */
+/*									 */
+/*************************************************************************/
+
+
+void    MyShow(T, Sh)
+    Tree T;
+    short Sh;
+{
+
+    DiscrValue v, MaxV;
+    short MaxLine();
+
+    int i; 
+
+    float weight;
+    Boolean found;
+    
+    if ( T->NodeType )
+    {
+
+      MaxV = T->Forks;
+      
+      /*  Print simple cases first */
+      
+      ForEach(v, 1, MaxV)
+	{
+	  if ( ! T->Branch[v]->NodeType )
+	    {
+	      MyShowBranch(Sh, T, v);
+	    }
+	}
+	
+	/*  Print subtrees  */
+	
+	ForEach(v, 1, MaxV)
+	  {
+	    if ( T->Branch[v]->NodeType )
+	      {
+		MyShowBranch(Sh, T, v);
+	      }
+	  }
+    }
+    else
+      {
+	printf(" %s (%.1f", ClassName[T->Leaf], T->Items);
+	if ( T->Errors > 0 ) printf("/%.1f", T->Errors);
+	printf(")");
+	if (VERBOSE && T->Items > 0)
+	{
+	  printf("[%.1f",T->ClassDist[0]);
+	  for(i=1;i<MaxClass+1;i++)
+	    printf(",%.1f",T->ClassDist[i]);
+	  printf("]");
+	}
+	if (PRINTCASES)
+	{
+	  printf("\n#");
+	  for(i=0;i<=MaxItem;i++)
+	  {
+	    weight = getWeight(DecisionTree,T,&Item[i],1.0,&found);
+	    if (found)
+	    {
+	      printf(" %d",i);
+	      if (PRINTWEIGHTS) printf("/%.2f",weight);
+	    }
+	  }
+	}
+      }
+}
+
+
+/*************************************************************************/
+/*									 */
+/*	Print a node T with offset Sh, branch value v, and continue	 */
+/*									 */
+/*************************************************************************/
+
+
+void MyShowBranch(Sh, T, v)
+/*  -----------  */
+    short Sh;
+    Tree T;
+    DiscrValue v;
+{
+
+    DiscrValue Pv, Last;
+    Attribute Att;
+    Boolean FirstValue;
+    short TextWidth, Skip, Values=0, i;
+    
+    Att = T->Tested;
+
+    switch ( T->NodeType )
+    {
+	case BrDiscr:
+
+	    MyIndent(Sh, Tab);
+
+	if (VERBOSE)
+	{
+	  printf("[%.1f",T->ClassDist[0]);
+	  for(i=1;i<MaxClass+1;i++)
+	    printf(",%.1f",T->ClassDist[i]);
+	  printf("]");
+	}
+
+	    printf("%s = %s:", AttName[Att], AttValName[Att][v]);
+	    break;
+
+	case ThreshContin:
+
+	    MyIndent(Sh, Tab);
+
+	if (VERBOSE)
+	{
+	  printf("[%.1f",T->ClassDist[0]);
+	  for(i=1;i<MaxClass+1;i++)
+	    printf(",%.1f",T->ClassDist[i]);
+	  printf("]");
+	}
+
+	    printf("%s %s %g ",
+		    AttName[Att], ( v == 1 ? "<=" : ">" ), T->Cut);
+
+	    if ( T->Lower != T->Upper )
+	    {
+		printf("[%g,%g]", T->Lower, T->Upper);
+	    }
+
+	    printf(":");
+	    break;
+
+	case BrSubset:
+
+	    /*  Count values at this branch  */
+
+	    ForEach(Pv, 1, MaxAttVal[Att])
+	    {
+		if ( In(Pv, T->Subset[v]) )
+		{
+		    Last = Pv;
+		    Values++;
+		}
+	    }
+	    if ( ! Values ) return;
+
+	    MyIndent(Sh, Tab);
+
+	if (VERBOSE)
+	{
+	  printf("[%.1f",T->ClassDist[0]);
+	  for(i=1;i<MaxClass+1;i++)
+	    printf(",%.1f",T->ClassDist[i]);
+	  printf("]");
+	}
+
+	    if ( Values == 1 )
+	    {
+		printf("%s = %s:", AttName[Att], AttValName[Att][Last]);
+		break;
+	    }
+
+	    printf("%s in {", AttName[Att]);
+	    FirstValue = true;
+	    Skip = TextWidth = strlen(AttName[Att]) + 5;
+
+	    ForEach(Pv, 1, MaxAttVal[Att])
+	    {
+		if ( In(Pv, T->Subset[v]) )
+		{
+		    if ( ! FirstValue &&
+			 TextWidth + strlen(AttValName[Att][Pv]) + 11 > Width )
+		    {
+		  	MyIndent(Sh, Tab);
+			ForEach(i, 1, Skip) putchar(' ');
+
+			TextWidth = Skip;
+			FirstValue = true;
+		    }
+
+		    printf("%s%c", AttValName[Att][Pv], Pv == Last ? '}' : ',');
+		    TextWidth += strlen(AttValName[Att][Pv]) + 1;
+		    FirstValue = false;
+		}
+	    }
+	    putchar(':');
+    }
+
+    MyShow(T->Branch[v], Sh+1);
+}
+
+
+/*************************************************************************/
+/*								   	 */
+/*	Indent Sh columns					  	 */
+/*								  	 */
+/*************************************************************************/
+
+void MyIndent(Sh, Mark)
+/*  ------  */
+    short Sh;
+    char *Mark;
+{
+    printf("\n");
+    while ( Sh-- ) printf("%s", Mark);
+}
+
+
+/*************************************************************************/
+/*								  	 */
+/*  Main routine for printing the tree */
+/*								  	 */
+/*************************************************************************/
+
+
+int    main(Argc, Argv)
+/*  ---- 	 */
+    int Argc;
+    char *Argv[];
+{
+    int o,i;
+    extern char *optarg;
+
+    PrintHeader("Decision tree display");
+
+    /*  Process options  */
+
+    while ( (o = getopt(Argc, Argv, "hUvwcuf:t:T:M:")) != EOF )
+    {
+	switch (o)
+	{
+	    case 'v':	VERBOSE = true;
+	                printf("\toption -v: Verbose output\n");
+			break;
+	    case 'w':	PRINTWEIGHTS = true;
+	                printf("\toption -w: Print weights\n");
+			break;
+	    case 'c':	PRINTCASES = true;
+	                printf("\toption -c: Print cases\n");
+			break;
+	    case 'u':	USETEST = true;
+	                printf("\toption -u: Use testset\n");
+			break; 
+	    case 'f':	FileName = optarg;
+	  	        printf("\tFile stem <%s>\n", FileName);
+			break;
+	    case 'M':   ModelSuffix = optarg;
+		        printf("\tModel name <%s>\n", ModelSuffix);
+		        break;
+	    case 't':	NumberTrial = atoi(optarg);
+	                printf("\noption -t: Use tree from trial %d\n",
+			       NumberTrial);
+			break;
+	    case 'U':	UNPRUNED = true;
+	                printf("\toption -U: Use unpruned tree\n");
+			break;
+   	    case 'T':   TARGETCOLUMN = atoi(optarg);
+		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		        break;
+            case 'h':   printf("usage: %s [-v] [-w] [-c] [-u] [-U] -t n -T n -M<name> -f stem\n",Argv[0]);
+			printf("  -v: Verbose - add class distribution info\n");
+			printf("  -w: show instance Weights\n");
+			printf("  -c: Cases: show instance numbers\n");
+			printf("  -u: use test data instead of training data\n");
+			printf("  -f xxxx: specify file stem\n");
+			printf("  -t n: use tree from trial n (default is first)\n");
+			printf("  -T n: use attribute n (1..max) as target\n");
+			printf("  -M<name>: use <fstem><name>.tree/unpruned\n");
+			printf("  -U: use Unpruned tree\n");
+                        exit(0);
+	    case '?':	printf("unrecognised option, usage: %s [-v] [-w] [-c] [-u] [-U] -t n -f stem\nor: %s -h",
+			       Argv[0],Argv[0]);
+			exit(1);
+	}
+    }
+
+    /*  Initialise  */
+
+    GetNames();
+
+    if (UNPRUNED)
+      for (i = 0; i<= NumberTrial; i++)
+	DecisionTree = GetTree(".unpruned");
+    else
+      DecisionTree = GetTree(".tree");
+
+    if(PRINTCASES)
+    {
+      if(USETEST)
+      {
+	GetData(".test");
+	printf("\nRead %d cases (%d attributes) from %s.test\n",
+	       MaxItem+1, MaxAtt+1, FileName);
+      } else {
+	GetData(".data");
+	printf("\nRead %d cases (%d attributes) from %s.data\n",
+	       MaxItem+1, MaxAtt+1, FileName);
+      }
+      /* add items to tree nodes */
+    }
+
+    MyPrintTree(DecisionTree);
+  
+    return 0;
+
+}
+
+
diff -Nu ../c45rel8/R8/Src/classify.c ./classify.c
--- ../c45rel8/R8/Src/classify.c	Fri Feb 28 23:52:09 2003
+++ ./classify.c	Fri Feb 28 23:52:09 2003
@@ -12,6 +12,7 @@
 
 float	*ClassSum=Nil;		/* ClassSum[c] = total weight of class c */
 
+static char * rcsid = "@(#)$Id: classify.c,v 1.4 1999/03/10 17:04:12 johann Exp $";
 
 
 /*************************************************************************/
diff -Nu ../c45rel8/R8/Src/confmat.c ./confmat.c
--- ../c45rel8/R8/Src/confmat.c	Fri Feb 28 23:52:09 2003
+++ ./confmat.c	Fri Feb 28 23:52:09 2003
@@ -9,6 +9,8 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: confmat.c,v 1.6 1999/03/10 17:04:13 johann Exp $";
+
 
     PrintConfusionMatrix(ConfusionMat)
 /*  --------------------  */
@@ -16,8 +18,6 @@
 {
     short Row, Col;
 
-    if ( MaxClass > 20 ) return;  /* Don't print nonsensical matrices */
-
     /*  Print the heading, then each row  */
 
     printf("\n\n\t");
@@ -44,7 +44,7 @@
 	    }
 	    else
 	    {
-		printf("     ");
+		printf("    0");
 	    }
 	}
 	printf("\t(%c): class %s\n", 'a' + Row, ClassName[Row]);
diff -Nu ../c45rel8/R8/Src/consult.1 ./consult.1
--- ../c45rel8/R8/Src/consult.1	Thu Jan  1 01:00:00 1970
+++ ./consult.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,107 @@
+.EN
+.TH C4.5 1
+.SH NAME
+.PP
+consult \- classify items using a decision tree
+.SH SYNOPSIS
+.PP
+.B consult
+[ \fB-f\fR FNS ]
+[ \fB-t\fR ]
+.SH DESCRIPTION
+.PP
+.I Consult
+reads a decision tree produced by c4.5 and
+uses this to classify items whose description
+is provided by the user.
+The decision tree read is
+.I filestem.tree,
+where
+.I filestem
+is the file name stem (see manual entry for c4.5).
+.PP
+.I Consult
+prompts for the value of an attribute when needed.
+Unknown attribute values are specified as '?'.
+.PP
+If the attribute has discrete values, its value
+can be specified either as
+.ti 8
+.I v
+.br
+where v is one of the permissible values of the attribute, or as
+.ti 8
+.I "v1:p1, v2:p2, ... , vn:pn"
+.br
+where the vi's are some or all of the permissible values of the
+attribute and the pi's are corresponding probabilities.
+If the sum of the pi's is less than 1, the remaining probability
+is distributed equally among the unspecified values of the
+attribute.  For example, if attribute A has possible values
+X, Y and Z, the reply
+.ti 8
+X:0.5
+.br
+is the same as
+.ti 8
+X:0.5, Y:0.25, Z:0.25
+.PP
+If the attribute has real values, its value can be
+specified either as
+.ti 8
+.I r
+.br
+where r is a real number, or as
+.ti 8
+.I r1 - r2
+.br
+where r1 and r2 are real numbers.  The latter form is
+taken to mean "somewhere in the interval [r1,r2]".
+.PP
+To display the subtree of the decision tree with the
+current node at the root, '?t' may be entered in
+response to a request for an attribute value.
+.PP
+When all relevant attributes have been determined,
+consult will give one or more classes that the item
+might belong to.  The likelihood of a class may be
+indicated by a probability, followed sometimes by a
+probability interval.  For example,
+.ti 8
+.I "C1  CF = 0.9 [0.85 - 1]"
+.br
+means "class C1 with probability in the interval 0.85 - 1,
+and with best guess probability 0.9".
+.PP
+At the end of each item, consult will prompt for
+retrial of the same item, a new item, or end of session.
+When retrying an item, the previous values of queried
+attributes are displayed in square brackets.  If the
+value is unchanged, reply with a carriage return;
+otherwise, specify the changed value.
+.PP
+Options and their meanings are:
+.PP
+.TP 12
+.BI \-f filestem\^
+Specify the filename stem (default
+.B DF)
+.TP
+.B \-t
+Display the decision tree at the start of the consulting
+session.
+.SH FILES
+.PP
+.in 8
+consult
+.br
+filestem.names
+.br
+filestem.tree
+.in 0
+.PP
+.SH SEE ALSO
+.PP
+c4.5(1)
+.PP
+.SH BUGS
diff -Nu ../c45rel8/R8/Src/consult.c ./consult.c
--- ../c45rel8/R8/Src/consult.c	Fri Feb 28 23:52:09 2003
+++ ./consult.c	Fri Feb 28 23:52:09 2003
@@ -9,34 +9,40 @@
 #include "defns.i"
 #include "types.i"
 
+static char * rcsid = "@(#)$Id: consult.c,v 1.8 1999/03/10 17:04:14 johann Exp $";
 
 		/*  External data  -- see c4.5.c for meanings  */
 
 short		MaxAtt, MaxClass, MaxDiscrVal;
 
-ItemNo		MaxItem;
+ItemNo		MaxItem,
+                TARGETCOLUMN = 0;
 
 Description	*Item;
 
 DiscrValue	*MaxAttVal;
 
 String		*ClassName,
+                *ClassAttr,
 		*AttName,
 		**AttValName,
+                ModelSuffix = 0,
 		FileName = "DF";
 
 char		*SpecialStatus;
 
 short		VERBOSITY = 0,
+                IGNOREMVCLASS = 0, /* not used */
 		TRACE     = 0;
 
+Boolean         PRINTTREE = true;
 
 	/*  The interview module uses a more complex description of an
 	    case called a "Range Description".   The value of an
 	    attribute is given by
 	    - lower and upper bounds (continuous attribute)
 	    - probability of each possible value (discrete attribute)  */
-
+ 
 
 typedef	struct ValRange *RangeDescRec;
 
@@ -59,7 +65,7 @@
 
 #define Fuzz	0.01			/* minimum weight */
 
-
+char suffixbuf[256];
 
 /*************************************************************************/
 /*								   	 */
@@ -429,7 +435,7 @@
 
     /*  Process options  */
 
-    while ( (o = getopt(Argc, Argv, "tvf:")) != EOF )
+    while ( (o = getopt(Argc, Argv, "tvf:T:M:")) != EOF )
     {
 	switch (o)
 	{
@@ -439,6 +445,12 @@
 			break;
 	    case 'f':	FileName = optarg;
 			break;
+	    case 'M':   ModelSuffix = optarg;
+		        printf("\tModel name <%s>\n", ModelSuffix);
+		        break;
+   	    case 'T':   TARGETCOLUMN = atoi(optarg);
+		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		        break;
 	    case '?':	printf("unrecognised option\n");
 			exit(1);
 	}
diff -Nu ../c45rel8/R8/Src/consultr.1 ./consultr.1
--- ../c45rel8/R8/Src/consultr.1	Thu Jan  1 01:00:00 1970
+++ ./consultr.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,100 @@
+.EN
+.TH C4.5 1
+.SH NAME
+.PP
+consultr \- classify items using a rule set
+.SH SYNOPSIS
+.PP
+.B consultr
+[ \fB-f\fR FNS ]
+[ \fB-t\fR ]
+.SH DESCRIPTION
+.PP
+.I Consultr
+reads a rule set produced by c4.5rules and
+uses this to classify items whose description
+is provided by the user.
+The rule set read is
+.I filestem.rules,
+where
+.I filestem
+is the file name stem (see manual entry for c4.5).
+.PP
+Consultr prompts for the value of an attribute when needed.
+Unknown attribute values are specified as '?'.
+.PP
+If the attribute has discrete values, its value
+can be specified either as
+.ti 8
+.I v
+.br
+where v is one of the permissible values of the attribute, or as
+.ti 8
+.I "v1:p1, v2:p2, ... , vn:pn"
+.br
+where the vi's are some or all of the permissible values of the
+attribute and the pi's are corresponding probabilities.
+If the sum of the pi's is less than 1, the remaining probability
+is distributed equally among the unspecified values of the
+attribute.  For example, if attribute A has possible values
+X, Y and Z, the reply
+.ti 8
+X:0.5
+.br
+is the same as
+.ti 8
+X:0.5, Y:0.25, Z:0.25
+.PP
+If the attribute has real values, its value can be
+specified either as
+.ti 8
+.I r
+.br
+where r is a real number, or as
+.ti 8
+.I r1 - r2
+.br
+where r1 and r2 are real numbers.  The latter form is
+taken to mean "somewhere in the interval [r1,r2]".
+.PP
+When all relevant attributes have been determined,
+consultr will give a class that the item might
+belong to.  The likelihood of the class may be
+indicated by a probability.  For example,
+.ti 8
+.I "C1  CF = 0.9"
+.br
+means "class C1 with probability 0.9".
+.PP
+At the end of each item, consultr will prompt for
+retrial of the same item, a new item, or end of session.
+When retrying an item, the previous values of queried
+attributes are displayed in square brackets.  If the
+value is unchanged, reply with a carriage return;
+otherwise, specify the changed value.
+.PP
+Options and their meanings are:
+.PP
+.TP 12
+.BI \-f filestem\^
+Specify the filename stem (default
+.B DF)
+.TP
+.B \-t
+Display the rule set at the start of the consulting
+session.
+.SH FILES
+.PP
+.in 8
+consultr
+.br
+filestem.names
+.br
+filestem.rules
+.in 0
+.PP
+.SH SEE ALSO
+.PP
+c4.5(1), c4.5rules(1)
+.PP
+.SH BUGS
diff -Nu ../c45rel8/R8/Src/consultr.c ./consultr.c
--- ../c45rel8/R8/Src/consultr.c	Fri Feb 28 23:52:09 2003
+++ ./consultr.c	Fri Feb 28 23:52:09 2003
@@ -9,20 +9,25 @@
 #include "defns.i"
 #include "types.i"
 
+static char * rcsid = "@(#)$Id: consultr.c,v 1.8 1999/03/10 17:04:15 johann Exp $";
 
 		/*  External data  */
 
-short		MaxAtt, MaxClass, MaxDiscrVal;
+short		MaxAtt, MaxClass, MaxDiscrVal,
+                IGNOREMVCLASS = 0; 
 
-ItemNo		MaxItem;
+ItemNo		MaxItem,
+                TARGETCOLUMN = 0;
 
 Description	*Item;
 
 DiscrValue	*MaxAttVal;
 
 String		*ClassName,
+                *ClassAttr,
 		*AttName,
 		**AttValName,
+                ModelSuffix = 0,
 		FileName = "DF";
 
 char		*SpecialStatus;
@@ -33,6 +38,8 @@
 
 Boolean		FirstTime = true;
 
+Boolean         PRINTTREE = true;
+
 PR		*Rule;
 
 RuleNo		NRules = 0,
@@ -61,6 +68,7 @@
 
 #define	MINCF	0.50		/* minimum cf for useable rule */
 
+char suffixbuf[256];
 
 /*************************************************************************/
 /*								  	 */
@@ -290,7 +298,7 @@
 
     /*  Process options  */
 
-    while ( (o = getopt(Argc, Argv, "tvf:")) != EOF )
+    while ( (o = getopt(Argc, Argv, "tvf:T:M:")) != EOF )
     {
 	switch (o)
 	{
@@ -300,6 +308,12 @@
 			break;
 	    case 'f':	FileName = optarg;
 			break;
+	    case 'M':   ModelSuffix = optarg;
+		        printf("\tModel name <%s>\n", ModelSuffix);
+		        break;
+   	    case 'T':   TARGETCOLUMN = atoi(optarg);
+		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		        break;
 	    case '?':	printf("unrecognised option\n");
 			exit(1);
 	}
diff -Nu ../c45rel8/R8/Src/contin.c ./contin.c
--- ../c45rel8/R8/Src/contin.c	Fri Feb 28 23:52:09 2003
+++ ./contin.c	Fri Feb 28 23:52:09 2003
@@ -8,6 +8,7 @@
 
 #include "buildex.i"
 
+static char * rcsid = "@(#)$Id: contin.c,v 1.4 1999/03/10 17:04:16 johann Exp $";
 
 float
 	*SplitGain,	/* SplitGain[i] = gain with att value of item i as threshold */
diff -Nu ../c45rel8/R8/Src/cvsstatus ./cvsstatus
--- ../c45rel8/R8/Src/cvsstatus	Thu Jan  1 01:00:00 1970
+++ ./cvsstatus	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,743 @@
+? tmp.h
+? c4.5
+? g1.names
+? crx.x.tree
+? c4.5rules
+? golf.data
+? golf.hyp
+? golf.lsp
+? golf.names
+? golf.test
+? crx-C16.unpruned
+? consult
+? golf.names.new
+? golf.names.ne
+? patch
+? g1.data
+? g2.names
+? g2.data
+? crx-C16.tree
+? g4.names
+? crx.x.unpruned
+? g3.names
+? g3.data
+? crx.x.1.unpruned
+? bconsult
+? crx.names
+? consultr
+? bconsultr
+? crx.x.1.tree
+? c4.5showtree
+? g2.labs
+? g2.test
+? g4.data
+? crx-c20.unpruned
+? g4.labs
+? g4.test
+? TODO
+? g1.labs
+? g1.rules
+? crx-c20.tree
+? golf.m5
+? crx.data
+? crx.unpruned
+? crx.tree
+? crx.rules
+? crx-C16.rules
+? c1.data
+? c1.names
+? c1.unpruned
+? c1.tree
+? c1.test
+? crx.labs
+? c4.5showrules
+? golf.unpruned
+? golf.tree
+? golf.rules
+? golf.labs
+? c45-oefai.tar.gz
+? cvsstatus
+===================================================================
+File: CHANGES          	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/CHANGES,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: Makefile         	Status: Up-to-date
+
+   Working revision:	1.12
+   Repository revision:	1.12	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/Makefile,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+
+===================================================================
+File: Modifications    	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/Modifications,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: average.c        	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/average.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: bconsult.1       	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/bconsult.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: bconsult.c       	Status: Up-to-date
+
+   Working revision:	1.5
+   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/bconsult.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: bconsultr.c      	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/bconsultr.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: besttree.c       	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/besttree.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: build.c          	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/build.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: buildex.i        	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/buildex.i,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: c4.5.1           	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: c4.5.c           	Status: Up-to-date
+
+   Working revision:	1.6
+   Repository revision:	1.6	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: c4.5rules.1      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5rules.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: c4.5rules.c      	Status: Up-to-date
+
+   Working revision:	1.6
+   Repository revision:	1.6	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5rules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: c4.5showrules.c  	Status: Up-to-date
+
+   Working revision:	1.5
+   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5showrules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: c4.5showtree.c   	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5showtree.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: classify.c       	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/classify.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: confmat.c        	Status: Up-to-date
+
+   Working revision:	1.5
+   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/confmat.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.4)
+	v0-7                     	(revision: 1.2)
+	v0-6                     	(revision: 1.2)
+	v0-5                     	(revision: 1.2)
+
+===================================================================
+File: consult.1        	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consult.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: consult.c        	Status: Up-to-date
+
+   Working revision:	1.7
+   Repository revision:	1.7	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consult.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.4)
+	v0-7                     	(revision: 1.2)
+	v0-6                     	(revision: 1.2)
+	v0-5                     	(revision: 1.2)
+
+===================================================================
+File: consultr.1       	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consultr.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: consultr.c       	Status: Up-to-date
+
+   Working revision:	1.7
+   Repository revision:	1.7	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consultr.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.4)
+	v0-7                     	(revision: 1.2)
+	v0-6                     	(revision: 1.2)
+	v0-5                     	(revision: 1.2)
+
+===================================================================
+File: contin.c         	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/contin.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: defns.i          	Status: Up-to-date
+
+   Working revision:	1.6
+   Repository revision:	1.6	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/defns.i,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.4)
+	v0-7                     	(revision: 1.2)
+	v0-6                     	(revision: 1.2)
+	v0-5                     	(revision: 1.2)
+
+===================================================================
+File: discr.c          	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/discr.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: extern.i         	Status: Up-to-date
+
+   Working revision:	1.5
+   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/extern.i,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: genlogs.c        	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/genlogs.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: genrules.c       	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/genrules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: getdata.c        	Status: Up-to-date
+
+   Working revision:	1.5
+   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/getdata.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: getnames.c       	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/getnames.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: getopt.c         	Status: Up-to-date
+
+   Working revision:	1.5
+   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/getopt.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.4)
+	v0-7                     	(revision: 1.2)
+	v0-6                     	(revision: 1.2)
+	v0-5                     	(revision: 1.2)
+
+===================================================================
+File: header.c         	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/header.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: info.c           	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/info.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: makerules.c      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/makerules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: prune.c          	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/prune.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: prunerule.c      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/prunerule.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: rules.c          	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/rules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: rulex.i          	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/rulex.i,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: siftrules.c      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/siftrules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: sort.c           	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/sort.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: st-thresh.c      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/st-thresh.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: stats.c          	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/stats.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: subset.c         	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/subset.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: testrules.c      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/testrules.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: trees.c          	Status: Up-to-date
+
+   Working revision:	1.7
+   Repository revision:	1.7	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/trees.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.4)
+	v0-7                     	(revision: 1.2)
+	v0-6                     	(revision: 1.2)
+	v0-5                     	(revision: 1.2)
+
+===================================================================
+File: types.i          	Status: Up-to-date
+
+   Working revision:	1.4
+   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/types.i,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: userint.c        	Status: Up-to-date
+
+   Working revision:	1.3
+   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/userint.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.3)
+	v0-7                     	(revision: 1.1)
+	v0-6                     	(revision: 1.1)
+	v0-5                     	(revision: 1.1)
+
+===================================================================
+File: verbose.1        	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/verbose.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: verbrules.1      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/verbrules.1,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
+===================================================================
+File: xval-prep.c      	Status: Up-to-date
+
+   Working revision:	1.1
+   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/xval-prep.c,v
+   Sticky Tag:		(none)
+   Sticky Date:		(none)
+   Sticky Options:	(none)
+
+   Existing Tags:
+	Vorig-rel8               	(revision: 1.1)
+
diff -Nu ../c45rel8/R8/Src/defns.i ./defns.i
--- ../c45rel8/R8/Src/defns.i	Fri Feb 28 23:52:09 2003
+++ ./defns.i	Fri Feb 28 23:52:09 2003
@@ -7,6 +7,7 @@
 
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <math.h>
 
 #define	 Eof			EOF             /*char read on end of file*/
@@ -16,14 +17,28 @@
 #define	 None			-1
 #define	 Epsilon                1E-3
 
-long	 random();
+#ifdef UNIX
 #define	 Random			((random()&2147483647) / 2147483648.0)
+#elif defined(DOS)
+/* :TODO: random doesnt exist at dos,we only have an int function rand that
+   returns a maximum value of 7fff
+   We probably should replace this with a decend random for both
+   UNIX and DOS.
+*/
+#define	Random                 ((rand()&32767) / 32768.0)
 
-#define	 Max(a,b)               ((a)>(b) ? a : b) 
+/* :TODO: we dont have cfree in DOS */
+#define cfree free
+#elif defined(LINUX)
+#define cfree free
+#define	 Random			((random()&2147483647) / 2147483648.0)
+#endif
+
+#define  Max(a,b)               ((a)>(b) ? a : b) 
 #define	 Min(a,b)               ((a)<(b) ? a : b) 
 #define	 Round(x)		((int) (x+0.5))
-#define	 Log2			0.69314718055994530942
-#define	 Log(x)			((x) <= 0 ? 0.0 : log((float)x) / Log2)
+#define	 Log2			0.69314718055994530942L
+#define	 Log(x)			((x) <= 0 ? 0.0 : log((double)x) / Log2)
 
 #define	 Bit(b)			(1 << (b))
 #define	 In(b,s)		((s[(b) >> 3]) & Bit((b) & 07))
diff -Nu ../c45rel8/R8/Src/discr.c ./discr.c
--- ../c45rel8/R8/Src/discr.c	Fri Feb 28 23:52:09 2003
+++ ./discr.c	Fri Feb 28 23:52:09 2003
@@ -8,6 +8,7 @@
 
 #include "buildex.i"
 
+static char * rcsid = "@(#)$Id: discr.c,v 1.4 1999/03/10 17:04:18 johann Exp $";
 
 /*************************************************************************/
 /*									 */
diff -Nu ../c45rel8/R8/Src/extern.i ./extern.i
--- ../c45rel8/R8/Src/extern.i	Fri Feb 28 23:52:09 2003
+++ ./extern.i	Fri Feb 28 23:52:09 2003
@@ -19,6 +19,7 @@
 extern  char		*SpecialStatus;	/* special att treatment */
 
 extern  String		*ClassName,	/* class names */
+			*ClassAttr,     /* Name of class atrribute */
 		  	*AttName,	/* att names */
 		  	**AttValName,	/* att value names */
 			FileName;	/* family name of files */
@@ -43,10 +44,12 @@
 			SUBSET,		/* true if subset tests allowed */
 			BATCH,		/* true if windowing turned off */
 			UNSEENS,	/* true if to evaluate on test data */
-			PROBTHRESH;	/* true if to use soft thresholds */
+			PROBTHRESH,	/* true if to use soft thresholds */
+	 		PRUNETREE;      /* true if trees should be pruned */
 
 extern  ItemNo		MINOBJS,	/* minimum items each side of a cut */
 			WINDOW,		/* initial window size */
+			TARGETCOLUMN,   /* to be used instead of last col */
 			INCREMENT;	/* max window increment each iteration */
 
 extern  float		CF;		/* confidence limit for tree pruning */
diff -Nu ../c45rel8/R8/Src/genlogs.c ./genlogs.c
--- ../c45rel8/R8/Src/genlogs.c	Fri Feb 28 23:52:09 2003
+++ ./genlogs.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: genlogs.c,v 1.4 1999/03/10 17:04:19 johann Exp $";
 
 float	*LogItemNo;
 double	*LogFact;
diff -Nu ../c45rel8/R8/Src/genrules.c ./genrules.c
--- ../c45rel8/R8/Src/genrules.c	Fri Feb 28 23:52:09 2003
+++ ./genrules.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 #include "rulex.i"
+static char * rcsid = "@(#)$Id: genrules.c,v 1.4 1999/03/10 17:04:20 johann Exp $";
 
 
 /*************************************************************************/
diff -Nu ../c45rel8/R8/Src/getdata.c ./getdata.c
--- ../c45rel8/R8/Src/getdata.c	Fri Feb 28 23:52:09 2003
+++ ./getdata.c	Sat Mar 15 10:34:25 2003
@@ -10,9 +10,12 @@
 #include "types.i"
 #include "extern.i"
 
-#define Inc 2048
+static char * rcsid = "@(#)$Id: getdata.c,v 1.6 1999/03/10 17:04:21 johann Exp $";
 
+#define Inc 2048
 
+short extern IGNOREMVCLASS;
+unsigned int NrMVClass;
 
 /*************************************************************************/
 /*									 */
@@ -89,19 +92,54 @@
     FILE *Df;
 {
     Attribute Att;
+    Attribute Col, TmpCol;
+    Attribute targetcol = TARGETCOLUMN-1;
     char name[500], *endname, *CopyString();
     Boolean ReadName();
     int Dv;
+    int ret;
     float Cv;
     Description Dvec;
     double strtod();
-
     if ( ReadName(Df, name) )
     {
 	Dvec = (Description) calloc(MaxAtt+2, sizeof(AttValue));
 
-        ForEach(Att, 0, MaxAtt)
+    again:
+	Att = -1;
+        ForEach(Col, 0, (TARGETCOLUMN==0 ? MaxAtt : (MaxAtt+1)))
         {
+	  /* if we are at column == TARGETCOLUMN, 
+	     lets put the data into the class column instead */
+	  if ((TARGETCOLUMN!=0) && (Col == targetcol)) {
+	    if ( (Dv = Which(name, ClassName, 0, MaxClass)) < 0 )
+	    {
+	      if (strcmp(name,"?") == 0) {
+		if (IGNOREMVCLASS==1) {
+		  NrMVClass++;
+		  ForEach(TmpCol, Col, (MaxAtt+1)) 
+		    if (!ReadName(Df, name) )
+		      return Nil;
+		  goto again;
+		} else if (IGNOREMVCLASS == 2) {
+		  NrMVClass++;
+		  Dv = 0;
+		} else {
+		  Error(6, "", name);
+		  NrMVClass++;
+		  Dv=0;
+		}
+	      } else {
+		Error(5, "", name);
+		NrMVClass++;
+		Dv = 0;
+	      }
+	    }
+	    Class(Dvec) = Dv;
+	    if (Col<=MaxAtt) ReadName(Df, name);
+	  } else { 
+	    
+	    Att++; 
 	    if ( SpecialStatus[Att] == IGNORE )
 	    {
 		/*  Skip this value  */
@@ -161,16 +199,40 @@
 		CVal(Dvec, Att) = Cv;
 	    }
 
-	    ReadName(Df, name);
+	    if (TARGETCOLUMN==0)
+	      ReadName(Df, name);
+	    else if (Col<=MaxAtt)
+	      ReadName(Df, name);
         }
-
-        if ( (Dv = Which(name, ClassName, 0, MaxClass)) < 0 )
-        {
-	    Error(5, "", name);
-	    Dv = 0;
-        }
-	Class(Dvec) = Dv;
-
+	} /* end of old code */
+	
+	if (TARGETCOLUMN==0) {
+	  
+	  if ( (Dv = Which(name, ClassName, 0, MaxClass)) < 0 )
+	  {
+	    if (strcmp(name,"?") == 0) {
+	      if (IGNOREMVCLASS==1) {
+		NrMVClass++;
+		ForEach(TmpCol, Col, (MaxAtt+1))
+		  if (!ReadName(Df, name) )
+		    return Nil;
+		goto again;
+	      } else if (IGNOREMVCLASS == 2) {
+		NrMVClass++;
+		Dv = 0;
+	      } else {
+		Error(5, "", name);
+		NrMVClass++;
+		Dv = 0;
+	      }}
+	    else {
+	      Error(5, "", name);
+	      NrMVClass++;
+	      Dv = 0;
+	    }
+	  }
+	  Class(Dvec) = Dv;
+	}
 	return Dvec;
     }
     else
diff -Nu ../c45rel8/R8/Src/getnames.c ./getnames.c
--- ../c45rel8/R8/Src/getnames.c	Fri Feb 28 23:52:09 2003
+++ ./getnames.c	Fri Feb 28 23:52:09 2003
@@ -13,6 +13,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+static char * rcsid = "@(#)$Id: getnames.c,v 1.5 1999/03/10 17:04:22 johann Exp $";
 
 #define  Space(s)	(s == ' ' || s == '\n' || s == '\t')
 #define  SkipComment	while ( ( c = getc(f) ) != '\n' )
@@ -126,7 +127,10 @@
 {
     FILE *Nf, *fopen();
     char Fn[100], Buffer[1000];
+    int targetcol = TARGETCOLUMN-1; /* zero based insted of 1-based */
+    char * tmpstrp;
     DiscrValue v;
+    int Col;
     int AttCeiling=100, ClassCeiling=100, ValCeiling;
 
     /*  Open names file  */
@@ -137,22 +141,37 @@
 
     /*  Get class names from names file  */
 
+
     ClassName = (String *) calloc(ClassCeiling, sizeof(String));
     MaxClass = -1;
-    do
-    {
+    
+    /* If we specify the column number of the target value
+       as a parameter, this won't exist in the names file
+       and has to be skipped.
+    */
+
+    if (TARGETCOLUMN == 0) {
+      
+      do
+      {
 	ReadName(Nf, Buffer);
-
+	
 	if ( ++MaxClass >= ClassCeiling)
 	{
-	    ClassCeiling += 100;
-	    ClassName = (String *) realloc(ClassName, ClassCeiling*sizeof(String));
+	  ClassCeiling += 100;
+	  ClassName = (String *) realloc(ClassName, ClassCeiling*sizeof(String));
 	}
 	ClassName[MaxClass] = CopyString(Buffer);
+      }
+      while ( Delimiter == ',' );
+      
     }
-    while ( Delimiter == ',' );
-
     /*  Get attribute and attribute value names from names file  */
+    
+    /* if the target Attribute is given as a paramter, we do the following:
+       after reading all attribute descriptions, swap the info for
+       the last and the specified attribute (if different)
+    */
 
     AttName = (String *) calloc(AttCeiling, sizeof(String));
     MaxAttVal = (DiscrValue *) calloc(AttCeiling, sizeof(DiscrValue));
@@ -160,10 +179,35 @@
     SpecialStatus = (char *) malloc(AttCeiling);
 
     MaxAtt = -1;
+    Col = 0;
     while ( ReadName(Nf, Buffer) )
     {
 	if ( Delimiter != ':' ) Error(1, Buffer, "");
 
+	/* if we are processing the target attribute, put info
+	   into class names instead of setting up an attribute;
+	   also remember the name of the class attribute
+	*/
+	if (targetcol == Col++) {
+	  
+	  ClassAttr = CopyString(Buffer); 
+	  do
+	  {
+	    if ( ! ( ReadName(Nf, Buffer) ) ) Error(2, "target values", "");
+	    
+	    if ( ++MaxClass >= ClassCeiling)
+	    {
+	      ClassCeiling += 100;
+	      ClassName = (String *) realloc(ClassName, ClassCeiling*sizeof(String));
+	    }
+	    ClassName[MaxClass] = CopyString(Buffer);
+	  }
+	  while ( Delimiter == ',' );
+
+	} else 
+
+	{ /* begin old code */
+
 	if ( ++MaxAtt >= AttCeiling )
 	{
 	    AttCeiling += 100;
@@ -236,9 +280,12 @@
 	}
 	else
 	if ( MaxAttVal[MaxAtt] > MaxDiscrVal ) MaxDiscrVal = MaxAttVal[MaxAtt];
+	} /* end old code */
     }
 
     fclose(Nf);
+
+
 }
 
 
@@ -316,6 +363,7 @@
 		break;
 
 	case 5: printf("case %d's class of '%s' is illegal\n", MaxItem+1, s2);
+	case 6: printf("case %d: missing value '%s' not allowed\n", MaxItem+1, s2);
     }
 
     if ( ++Messages > 10 )
diff -Nu ../c45rel8/R8/Src/getopt.c ./getopt.c
--- ../c45rel8/R8/Src/getopt.c	Fri Feb 28 23:52:09 2003
+++ ./getopt.c	Fri Feb 28 23:52:09 2003
@@ -10,7 +10,7 @@
 
 
 #include <stdio.h>
-
+static char * rcsid = "@(#)$Id: getopt.c,v 1.6 1999/03/10 17:04:23 johann Exp $";
 
 int optind = 1;
 char *optarg;
@@ -19,7 +19,8 @@
     getopt(Argc, Argv, Str)
 /*  ------  */
     int Argc;
-    char **Argv, *Str;
+    char * const *Argv;
+    const char *Str;
 {
     int Optchar;
     char *Option;
diff -Nu ../c45rel8/R8/Src/header.c ./header.c
--- ../c45rel8/R8/Src/header.c	Fri Feb 28 23:52:09 2003
+++ ./header.c	Fri Feb 28 23:52:09 2003
@@ -5,6 +5,7 @@
 /*									 */
 /*************************************************************************/
 
+static char * rcsid = "@(#)$Id: header.c,v 1.4 1999/03/10 17:04:25 johann Exp $";
 
 #define  RELEASE "8"
 
diff -Nu ../c45rel8/R8/Src/info.c ./info.c
--- ../c45rel8/R8/Src/info.c	Fri Feb 28 23:52:09 2003
+++ ./info.c	Fri Feb 28 23:52:09 2003
@@ -8,6 +8,7 @@
 
 #include "buildex.i"
 
+static char * rcsid = "@(#)$Id: info.c,v 1.4 1999/03/10 17:04:26 johann Exp $";
 
 /*************************************************************************/
 /*									 */
@@ -45,7 +46,7 @@
     }
     else
     {
-	return ( ThisInfo > 0 && ThisGain > -Epsilon ? ThisGain : -Epsilon );
+	return ThisInfo > 0 && ThisGain > 0 ? ThisGain : - Epsilon;
     }
 }
 
@@ -145,7 +146,7 @@
 /*  Compute the total information in V[ MinVal..MaxVal ]		 */
 /*									 */
 /*************************************************************************/
-
+ 
 
 float TotalInfo(V, MinVal, MaxVal)
 /*    ---------  */
@@ -153,18 +154,25 @@
     DiscrValue MinVal, MaxVal;
 {
     DiscrValue v;
-    float Sum=0.0;
+    double Sum=0.0;
     ItemCount N, TotalItems=0;
 
     ForEach(v, MinVal, MaxVal)
     {
 	N = V[v];
-
-	Sum += N * Log(N);
+	/* JP: originally there was just a line:
+	   Sum += N * Log(N);
+           With gcc 2.95.1 and optimization on, this produced 
+	   wrong results (NaN). Strangely, when Log(N) is
+	   *looked at* before it is used for the Sum, it would work!
+	   Looks like a compiler bug to me
+	*/
+	if (Log(N) > 9999999.999) { printf(""); }
+	Sum += (double)N * Log(N);
 	TotalItems += N;
     }
-
-    return TotalItems * Log(TotalItems) - Sum;
+ 
+    return (double)TotalItems * Log(TotalItems) - (double)Sum;
 }
 
 
diff -Nu ../c45rel8/R8/Src/makerules.c ./makerules.c
--- ../c45rel8/R8/Src/makerules.c	Fri Feb 28 23:52:09 2003
+++ ./makerules.c	Fri Feb 28 23:52:09 2003
@@ -11,6 +11,7 @@
 #include "extern.i"
 #include "rulex.i"
 
+static char * rcsid = "@(#)$Id: makerules.c,v 1.2 1999/03/10 17:04:27 johann Exp $";
 
 ItemNo	*TargetClassFreq,	/* [Boolean] */
 	*Errors,		/* [Condition] */
@@ -179,7 +180,7 @@
 	}
     }
     else
-    if ( t->Items >= 1 )
+    if ( t->Items > 1 )
     {
 	/*  Leaf of decision tree - construct the set of
  	    conditions associated with this leaf and prune  */
diff -Nu ../c45rel8/R8/Src/patch ./patch
--- ../c45rel8/R8/Src/patch	Thu Jan  1 01:00:00 1970
+++ ./patch	Sat Mar 15 11:02:59 2003
@@ -0,0 +1,4821 @@
+diff -Nu ../c45rel8/R8/Src/CHANGES ./CHANGES
+--- ../c45rel8/R8/Src/CHANGES	Thu Jan  1 01:00:00 1970
++++ ./CHANGES	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,69 @@
++This describes the changes and additions included in the 
++OFAI-patch.
++
++Portability note:
++  small differences between LINUX and Solaris compiled
++  programs are probably due to floating point 
++  inaccuracies.
++
++
++2000-03-16: modification of info.c to avoid a compiler bug
++  with GNU C 2.95.1. on LINUX and DOS systems
++  In the code section
++     N = V[v];
++     Sum += N * Log(N);
++  code generated with the -O option will always generate NaN.
++
++  Inserting an otherwise useless statement like:
++   N = V[v];
++   if (Log(N) > 9999999.999) { printf(""); }
++   Sum += N * Log(N);
++  will make the code work es expected again!
++
++
++Original:
++
++Note that the programs consult and consultr have not been
++modified; none of the modifications described below
++have been incorporated to these programs, unless the
++automatically also apply to them (f.i. missing value
++representation)
++
++- Programs made more portable; now compile under DOS
++  using MSVC++ and CygWin32
++
++- missing value representation for continuous attributes 
++  changed from -999 to FLT_MIN, for GNU compiler, and
++  1.1E-38 for other compilers.
++
++- added the program bconsult for creating a file that contains
++  the class labels assigned to the training or test set after
++  a tree has been built with the c4.5 program.
++
++- added the program bconsultr: same as bconsult for rules.
++
++- added the -h (help) option to some programs to show a short summary
++  of available options.
++
++- added the -I<n> (ignroe) option: n=1: ignore cases with MV as case label;
++  n=2: substitute first label from label list for MVs.
++
++- added the -T<n> (target) option: target (class) attribute is the
++  n-th attribute, not the last (as usual). When this option
++  is used, the .names file has to have a slightly different
++  format: the class label list at the beginning has to be ommited,
++  and an additional attribute description (discrete) has to 
++  be provided for the class attribute. Note that this format is
++  even then required, when the -T paramter specifies the
++  last attribute.
++
++- slight modification to the way class confusion matrices are
++  printed: a zero (0) will be printed instead of empty space.
++
++- Added the -S (suppress) option to suppress the printout of the generated
++  decision trees.
++
++- Added the -O (overfit) option to deliberatly generate an unpruned tree
++
++- Added the -M (modelname) option to store tree and rule files to
++  something like <filestem><modelname>.tree 
+diff -Nu ../c45rel8/R8/Src/Makefile ./Makefile
+--- ../c45rel8/R8/Src/Makefile	Fri Feb 28 23:52:09 2003
++++ ./Makefile	Sat Mar 15 11:02:56 2003
+@@ -1,121 +1,173 @@
+-#*************************************************************************#
+-#*									 *#
+-#*		Makefile for the C4.5 induction system			 *#
+-#*		--------------------------------------			 *#
+-#*									 *#
+-#*************************************************************************#
++# -*-Mode:Makefile-*-
++# @(#)$Id: Makefile,v 1.14 1999/03/16 16:37:39 johann Exp $
+ 
++# Makefile for extended C4.5 for both UNIX and DOS
++# 
++# Comment out all you dont want, and uncomment what you need
++# for your specific configuration.
+ 
+-#	Set CFLAGS for your C compiler, e.g.
+-#
+-#	  * if you need to debug the programs (sorry about that!)
+-#	      CFLAGS = -g
+-#	    (You might also want to reactivate the lint commands that
+-#	    have been commented out below.)
+-#
+-#	  * if your C compiler supports higher optimization levels
+-#	      CFLAGS = -O3 etc
+ 
++# C flags for DOS in DEBUG mode
++#CCFLGS = /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /c /D "__DOS__"  /D "DEBUG" /D "DOS"  /Tc
++
++# C flags for DOS in RELEASE mode
++#CCFLGS = /D "_CONSOLE" /c /D "__DOS__" /D "DOS" /O2 /Og /Ot /TC /w /Za
++
++# With cygwin32 Gnu C under Windows, use one of the settings below, 
++# but change -D"UNIX" to -D"DOS"
++
++# C flags for UNIX in DEBUG mode
++#CCFLGS =  -c -w -D"UNIX" -g -O1
++
++# C flags for UNIX in RELEASE mode
++#CCFLGS = -c  -D"UNIX" -O3 -Wall -ansi
++#CCFLGS = -c  -D"DOS" -O3 -Wall -ansi
++CCFLGS = -c -D"LINUX" -O3 
++
++# LINK flags for DOS
++#LDFLGS = kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /machine:I386 /out:
++
++# LINK flags for UNIX 
++LDFLGS = -lm -o
++
++# compile command, DOS
++# CCCMD = cl
++
++# compile command, UNIX and DOS/cygwin32
++CCCMD = gcc
++
++# link command, DOS
++#LDCMD = link
++
++# link command, UNIX adn DOS/cygwin32
++LDCMD = gcc
+ 
+-CFLAGS = -O2
++# delete command for clean, DOS
++#RMCMD = del
+ 
++# delete command for clean, UNIX
++RMCMD = /bin/rm -f
+ 
+-#	Definitions of file sets
+ 
+-core.ln = \
+-	getnames.ln getdata.ln trees.ln getopt.ln header.ln
++# extensions for UNIX (use the object extension for DOS/cygwin32 too)
++XX = 
++XO = .o
+ 
+-trees.ln = \
+-	besttree.ln build.ln info.ln discr.ln contin.ln subset.ln\
+-	prune.ln stats.ln st-thresh.ln classify.ln confmat.ln\
+-	sort.ln $(core.ln)
++# extensions for DOS
++#XX = .exe
++#XO = .obj
++
++# install command for UNIX
++INSTCMD = /bin/cp
++
++# install command for DOS
++#INSTCMD = copy
++
++# install pathes for UNIX
++MANPATH = /usr/local/ml/man
++BINPATH = /usr/local/ml/bin
++
++
++#################################################################
++## END OF CONFIGURE STUFF
++#################################################################
++
++.SUFFIXES:
++.SUFFIXES: .c $(XO)
++.PHONY: patch
++#
++# THE executables to be created
++# 
++
++TARGETS = c4.5$(XX) c4.5rules$(XX) consult$(XX) bconsult$(XX) consultr$(XX) \
++          bconsultr$(XX) c4.5showtree$(XX) c4.5showrules$(XX) 
++
++MANUALS = c4.5.1 c4.5rules.1 verbose.1 verbrules.1 bconsult.1 consult.1 \
++	bconsultr.1 c4.5oefai.1 c4.5rulesoefai.1 c4.5showrules consultr.1  \
++	c4.5showtree.1 
++
++#
++# GROUPS OF OBJECTS FILES THAT BELONG TOGETHER
++#
+ 
+-rules.ln = \
+-	rules.ln genlogs.ln genrules.ln makerules.ln prunerule.ln\
+-	siftrules.ln testrules.ln stats.ln confmat.ln sort.ln $(core.ln)
++core = getnames$(XO) getdata$(XO) trees$(XO) getopt$(XO) header$(XO)
+ 
+-core = \
+-	getnames.o getdata.o trees.o getopt.o header.o
++trees = besttree$(XO) build$(XO) info$(XO) discr$(XO) contin$(XO) \
++   subset$(XO) prune$(XO) stats$(XO) st-thresh$(XO) classify$(XO) \
++   confmat$(XO) sort$(XO) $(core)
+ 
+-trees = \
+-	besttree.o build.o info.o discr.o contin.o subset.o prune.o\
+-	stats.o st-thresh.o classify.o confmat.o sort.o $(core)
++rules = rules$(XO) genlogs$(XO) genrules$(XO) makerules$(XO) prunerule$(XO)\
++        siftrules$(XO) testrules$(XO) stats$(XO) confmat$(XO) sort$(XO) $(core)
+ 
+-rules = \
+-	rules.o genlogs.o genrules.o makerules.o prunerule.o\
+-	siftrules.o testrules.o stats.o confmat.o sort.o $(core)
++includes = buildex.i defns.i extern.i rulex.i types.i
+ 
++all: $(TARGETS)
+ 
+-#  C4.5 decision tree generator
++$(core) $(tree) $(rules): $(includes)
+ 
+-c4.5:	c4.5.o $(trees)
+-#	lint -x c4.5.ln $(trees.ln) -lm
+-	cc -o c4.5 c4.5.o $(trees) -lm
+ 
+-#	(Sample only: for compiler that supports global optimization,
+-#	 e.g. DECstation 3100)
++clean:
++	$(RMCMD) *$(XO) $(TARGETS) *~ patch
+ 
+-c4.5gt:
+-	cat	defns.i types.i\
+-		c4.5.c\
+-		besttree.c build.c info.c discr.c contin.c subset.c\
+-		prune.c stats.c st-thresh.c confmat.c sort.c\
+-		getnames.c getdata.c classify.c trees.c header.c\
+-		| egrep -v 'defns.i|types.i|extern.i|buildex.i' >c4.5gt.c
+-	cc -O4 -o c4.5gt c4.5gt.c -lm
+-	rm c4.5gt.c
++install:  all
++	$(INSTCMD) $(TARGETS) $(BINPATH)
++	$(INSTCMD) $(MANUALS) $(MANPATH)/man1
+ 
++################
++# DEPENDENCIES
++################
+ 
+-#  C4.5 production rule generator
++c4.5$(XX): c4.5$(XO) $(trees)
++	$(LDCMD) c4.5$(XO) $(trees) $(LDFLGS)$@	
+ 
+-c4.5rules: c4.5rules.o $(rules)
+-#	lint -x c4.5rules.ln $(rules.ln) -lm
+-	cc -o c4.5rules c4.5rules.o $(rules) -lm
++c4.5rules$(XX): c4.5rules$(XO) $(rules)
++	$(LDCMD) c4.5rules$(XO) $(rules) $(LDFLGS)$@
+ 
++consult$(XX): consult$(XO) userint$(XO) $(core)
++	$(LDCMD) consult$(XO) userint$(XO) $(core) \
++        $(LDFLGS)$@
+ 
+-c4.5rulesgt:
+-	cat	defns.i types.i\
+-		c4.5rules.c\
+-		rules.c genlogs.c genrules.c makerules.c prunerule.c\
+-		siftrules.c testrules.c stats.c confmat.c sort.c\
+-		getnames.c getdata.c classify.c trees.c header.c\
+-		| egrep -v 'defns.i|types.i|extern.i|rulex.i' >c4.5rulesgt.c
+-	cc -O4 -o c4.5rulesgt c4.5rulesgt.c -lm
+-	rm c4.5rulesgt.c
++bconsult$(XX): bconsult$(XO) $(trees)
++	$(LDCMD) bconsult$(XO) $(trees) \
++        $(LDFLGS)$@
+ 
++consultr$(XX): consultr$(XO) rules$(XO) userint$(XO) $(core)
++	$(LDCMD) consultr$(XO) rules$(XO) userint$(XO) $(core) \
++        $(LDFLGS)$@
+ 
++bconsultr$(XX): bconsultr$(XO)  $(rules)
++	$(LDCMD) bconsultr$(XO)   $(rules) \
++        $(LDFLGS)$@
+ 
+-#  C4.5 decision tree interpreter
++c4.5showtree$(XX): c4.5showtree$(XO)  userint$(XO) $(core)
++	$(LDCMD) c4.5showtree$(XO) userint$(XO) $(core) \
++        $(LDFLGS)$@
+ 
+-consult: consult.o userint.o $(core)
+-#	lint -x consult.ln userint.ln $(core.ln)
+-	cc -o consult consult.o userint.o $(core)
++c4.5showrules$(XX): c4.5showrules$(XO)  $(rules)
++	$(LDCMD) c4.5showrules$(XO) $(rules) \
++        $(LDFLGS)$@
+ 
+ 
+-#  C4.5 production rule interpreter
++.c$(XO):
++	$(CCCMD) $(CCFLGS) $<
+ 
+-consultr: consultr.o rules.o userint.o $(core)
+-#	lint -x consultr.ln rules.ln userint.ln $(core.ln)
+-	cc -o consultr consultr.o rules.o userint.o $(core)
++#########################################################
+ 
++# Stuff below this line only relevant for development ...
+ 
+-.c.o:
+-#	lint -c $<
+-	cc $(CFLAGS) -c $<
+ 
+ 
++patch:  clean 
++	diff -Nu  ../c45rel8/R8/Src . > patch
+ 
++ALLDIST =  *.c *.i *.1 Makefile CHANGES Modifications 
+ 
+-#  Make everything
++dist:
++	@echo CREATING DISTRIBUTION FILE
++	gtar -zcvf c45-oefai.tar.gz $(ALLDIST)
+ 
+-all:
+-	make c4.5
+-	make c4.5rules
+-	make consult
+-	make consultr
+-	cc -o xval-prep xval-prep.c
+-	cc -o average average.c -lm
++dos-dist:
++	zip c45-oefai.zip $(ALLDIST)
+ 
++.phony: patch
+ 
+-$(trees): defns.i types.i extern.i
+-$(rules): defns.i types.i extern.i
+diff -Nu ../c45rel8/R8/Src/average.c ./average.c
+--- ../c45rel8/R8/Src/average.c	Fri Feb 28 23:52:09 2003
++++ ./average.c	Fri Feb 28 23:52:09 2003
+@@ -14,6 +14,8 @@
+ #define	MAXLINE		200	/* max line length */
+ #define MAXVALS		 10	/* max values to be averaged */
+ 
++static char * rcsid = "@(#)$Id: average.c,v 1.2 1999/03/10 17:04:02 johann Exp $";
++
+ 
+ main()
+ {
+diff -Nu ../c45rel8/R8/Src/bconsult.1 ./bconsult.1
+--- ../c45rel8/R8/Src/bconsult.1	Thu Jan  1 01:00:00 1970
++++ ./bconsult.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,71 @@
++.\" troff -man %
++.\"
++.\" DO NOT EDIT
++.\"
++.\" This manual page is automatically generated by class2man.
++.\"
++.ds sV Mar 16, 1999
++.ds sC bconsult
++.ds sS 1
++.TH "\*(sC" "\*(sS" "\*(sV" "" ""
++.PP
++.SH "NAME"
++bconsult \- 
++Batch classify instances using C4.5 decision tree
++.SH "SYNOPSIS"
++.nf
++\f(CO
++bconsult [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>]
++\fP
++.fi
++.PP
++.SH "DESCRIPTION"
++This program allows the creation of a file containing class
++labels from a \f(CO.data\fP or a \f(CO.test\fP file and \f(CO.tree\fP file previously
++generated with the \f(COc4.5\fP program. The class labels will be stored
++into a file that has extension \f(CO.labs\fP.
++.PP
++.SH "ARGUMENTS"
++The program takes the following command-line arguments:
++.nf
++\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
++\f(CO-M<name>\fP: Add the given name to the filestem for the 
++    files containing the trees 
++    (fstem.tree and fstem.unpruned)
++    and the file that will contain the class labels
++    (fstem.labs)  (default: empty)
++\f(CO-u\fP: Use the unpruned tree, not the pruned one
++\f(CO-l\fP: Use the training data (fstem.data), not the
++    test data (fstem.test).
++\f(CO-v<n>\fP: Verbosity level (default: 0)
++\f(CO-t<n>\fP: Also print the tree (default: don't)
++\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
++    If this paramter is not give, the classic C4.5
++    scheme is used: the last attribute in the data file
++    contains the class label and the names file contains
++    the list of allowed class labels as its first entry.
++    If this parameter is given, any discrete attribute 
++    in the data file can be used as class attribute.
++    The names file must contain an attribute description
++    entry for all attribues, and must not contain the
++    initial entry describing the class labels (the class
++    labels are now described in the corresponding attribute
++    description entry)
++\f(CO-h\fP: Show help information about valid options
++.fi
++.PP
++.SH "DATE"
++$Date: 1999/03/16 16:37:40 $
++.PP
++.SH "NOTES"
++Note that the input file has to contain the attribute for 
++the class labels, even though its contents will not be used.
++The attribute must only contain values allowed as described
++in the names file, or missing value indicators (quetsion marks).
++.PP
++.SH "VERSION"
++$Revision: 1.3 $
++.PP
++.SH "AUTHOR(S)"
++Johann Petrak using big portions of the original code by 
++J.R. Quinlan
+diff -Nu ../c45rel8/R8/Src/bconsult.c ./bconsult.c
+--- ../c45rel8/R8/Src/bconsult.c	Thu Jan  1 01:00:00 1970
++++ ./bconsult.c	Sat Mar 15 10:36:56 2003
+@@ -0,0 +1,300 @@
++ /*************************************************************************/
++/*									 */
++/*	bconsult          						 */
++/*	------------------						 */
++/*									 */
++/*************************************************************************/
++
++/* the following comment follows the formatting conventions
++   of the OSE developmnet tools to allow automatic 
++   creation of man pages
++*/
++
++/*
++// [bconsult]
++//
++// = FILENAME
++//   bconsult.c
++//
++// = AUTHOR(S)
++//   Johann Petrak using big portions of the original code by 
++//   J.R. Quinlan
++//
++// = TITLE
++//   Batch classify instances using C4.5 decision tree
++//
++// = DESCRIPTION
++//   This program allows the creation of a file containing class
++//   labels from a <.data> or a <.test> file and <.tree> file previously
++//   generated with the <c4.5> program. The class labels will be stored
++//   into a file that has extension <.labs>.
++//
++// = SYNOPSIS
++//   bconsult [-f\<fstem\>] [-M\<name\>] [-u] [-l] [-v\<n\>] [-t] [-T\<n\>]
++//
++// = ARGUMENTS
++//   The program takes the following command-line arguments:
++// = BEGIN<NOFILL>
++//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
++//   <-M\<name\>>: Add the given name to the filestem for the 
++//       files containing the trees 
++//       (fstem.tree and fstem.unpruned)
++//       and the file that will contain the class labels
++//       (fstem.labs)  (default: empty)
++//   <-u>: Use the unpruned tree, not the pruned one
++//   <-l>: Use the training data (fstem.data), not the
++//       test data (fstem.test).
++//   <-v\<n\>>: Verbosity level (default: 0)
++//   <-t\<n\>>: Also print the tree (default: don't)
++//   <-T\<n\>>: Specify target attribute number (counting from 1).
++//       If this paramter is not give, the classic C4.5
++//       scheme is used: the last attribute in the data file
++//       contains the class label and the names file contains
++//       the list of allowed class labels as its first entry.
++//       If this parameter is given, any discrete attribute 
++//       in the data file can be used as class attribute.
++//       The names file must contain an attribute description
++//       entry for all attribues, and must not contain the
++//       initial entry describing the class labels (the class
++//       labels are now described in the corresponding attribute
++//       description entry)
++//   <-h>: Show help information about valid options
++//   
++// = END<NOFILL>
++//
++// = NOTES
++//   Note that the input file has to contain the attribute for 
++//   the class labels, even though its contents will not be used.
++//   The attribute must only contain values allowed as described
++//   in the names file, or missing value indicators (quetsion marks).
++//
++// = VERSION
++//   $Revision: 1.9 $
++//
++// = DATE
++//   $Date: 1999/03/16 16:37:41 $
++//
++// = COPYRIGHT
++//   Copyright (1997) Austrian Research Institute
++//   for Artificial Intelligence, Vienna, Austria
++//
++//===============
++
++
++ */
++
++
++#include "defns.i"
++#include "types.i"
++
++static char * rcsid = "@(#)$Id: bconsult.c,v 1.9 1999/03/16 16:37:41 johann Exp $";
++
++    /*  External data, described in extern.i  */
++
++unsigned int NrMVClass = 0;
++
++short		MaxAtt, MaxClass, MaxDiscrVal = 2;
++
++ItemNo		MaxItem;
++
++Description	*Item;
++
++DiscrValue	*MaxAttVal;
++
++char		*SpecialStatus;
++
++String		*ClassName,
++                *ClassAttr,
++		*AttName,
++		**AttValName,
++                ModelSuffix = 0,
++		FileName = "DF";
++
++short		VERBOSITY = 0,
++                IGNOREMVCLASS = 0,
++		TRIALS    = 10;
++
++Boolean         PRINTTREE = true,
++                PRUNETREE  = true;
++
++Boolean		GAINRATIO  = true,
++		SUBSET     = false,
++		BATCH      = true,
++		UNSEENS    = false,
++		PROBTHRESH = false,
++	        TRACE      = false,
++                TRAIN      = false,
++	        UNPRUNED   = false;
++
++ItemNo		MINOBJS   = 2,
++		TARGETCOLUMN = 0,
++		WINDOW    = 0,
++		INCREMENT = 0;
++
++float		CF = 0.25;
++
++Tree		*Pruned;
++
++Tree   DecisionTree,			/* tree being used */
++       GetTree();
++
++Boolean		AllKnown = true;
++
++char suffixbuf[256];
++
++WriteLabs(Extension)
++  String Extension;
++{
++  char Fn[500];
++  FILE *TRf = 0;
++  
++  ClassNo RealClass, PrunedClass, Category();
++  short t;
++  ItemNo *ConfusionMat, i, PrunedErrors;
++  
++  strcpy(Fn, FileName);
++  strcat(Fn, Extension);
++  if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
++
++  ConfusionMat = (ItemNo *) calloc((MaxClass+1)*(MaxClass+1), sizeof(ItemNo));
++  
++  printf("\n");
++  
++  PrunedErrors = 0;
++
++  ForEach(i, 0, MaxItem)
++    {
++      RealClass = Class(Item[i]);
++      PrunedClass = Category(Item[i], DecisionTree);
++      
++      fprintf(TRf,"%s\n",ClassName[PrunedClass]);
++
++      if ( PrunedClass != RealClass ) PrunedErrors++;
++      ConfusionMat[RealClass*(MaxClass+1)+PrunedClass]++;
++    }
++      
++  fclose(TRf);
++
++  printf("\t%4d  %3d(%4.1f%%)\n",
++	 TreeSize(DecisionTree), PrunedErrors,
++	 100.0*PrunedErrors / (MaxItem+1.0));
++
++  
++  
++  PrintConfusionMatrix(ConfusionMat);
++  free(ConfusionMat);
++}
++
++
++    main(Argc, Argv)
++/*  ----  */
++    int Argc;
++    char *Argv[];
++{
++    int o;
++    extern char *optarg;
++    extern int optind;
++    Boolean FirstTime=true;
++    short Best, BestTree();
++
++    PrintHeader("(OFAI) labels from tree generator");
++
++    /*  Process options  */
++
++    while ( (o = getopt(Argc, Argv, "f:v:tuT:lM:hI:")) != EOF )
++    {
++	if ( FirstTime && o != 'h')
++	{
++	    printf("\n    Options:\n");
++	    FirstTime = false;
++	}
++
++	switch (o)
++	{
++	case 'f':   FileName = optarg;
++		    printf("\tFile stem <%s>\n", FileName);
++		    break;
++	case 'M':   ModelSuffix = optarg;
++		    printf("\tModel name <%s>\n", ModelSuffix);
++		    break;
++	case 'v':   VERBOSITY = atoi(optarg);
++		    printf("\tVerbosity level %d\n", VERBOSITY);
++		    break;
++	case 't':   TRACE = true;
++		    printf("\tPrint tree\n", VERBOSITY);
++		    break;
++	case 'u':   UNPRUNED = true;
++		    printf("\tUse unpruned tree\n", VERBOSITY);
++		    break;
++	case 'l':   TRAIN = true;
++		    printf("\tUse training (learning) set\n", VERBOSITY);
++		    break;
++	case 'T':   TARGETCOLUMN = atoi(optarg);
++	            printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++		    break;
++	case 'I':   IGNOREMVCLASS = atoi(optarg);
++	            if (IGNOREMVCLASS == 0)
++		      printf("\tStandard handling of MVs as class values\n");
++		    else if  (IGNOREMVCLASS == 1)
++		      printf("\tIgnore cases with MV as class value\n");
++		    else if  (IGNOREMVCLASS == 2)
++		      printf("\tSubstitute first class label instead of MVs\n");
++		    else {
++		      printf("%s not a valid argument for option -I\n",optarg);
++		      exit(1);
++		    }
++		    break;
++	  case 'h': printf("usage: %s [options]\n", Argv[0]);
++	            printf("  options: [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>] \n");
++		    printf("  -f<fstem>: filestem (DF)\n");
++		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
++		    printf("  -u:        use unpruned tree (use pruned)\n");
++		    printf("  -l:        use training set (test set)\n");
++		    printf("  -v<n>:     verbosity level (0)\n");
++		    printf("  -t:        print tree (dont print tree)\n");
++		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
++		    printf("  -I<n>:     n=0: treat MV in class as error (default)\n");
++		    printf("             n=1: ignore records w/ MV in class\n");
++		    printf("             n=2: substitute first class label  (treat as error)\n");
++		    printf("  -h:        show this help info\n");
++		    printf("\n\n  The program will create a file <fstem>.labs that contains\n  the assigned class labels, one in each row\n");
++		    exit(1);
++		    break;
++	case '?':   printf("unrecognised option, use -h for help\n");
++		    exit(1);
++	}
++    }
++
++    /*  Initialise  */
++
++    GetNames();
++    
++    GetData(TRAIN ? ".data" : ".test");
++    printf("\nRead %d cases (%d attributes) from %s.%s\n",
++	   MaxItem+1, MaxAtt+1, FileName, (TRAIN ? "data" : "test"));
++
++    if (IGNOREMVCLASS == 1)
++      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
++    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
++      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
++    /* read the tree */
++    DecisionTree = GetTree((UNPRUNED ? ".unpruned" : ".tree"));
++    if ( TRACE ) PrintTree(DecisionTree);
++
++    /*GetData(".test");*/
++    printf("\nGenerate labels file from %s data (%d items):\n", 
++	   (TRAIN ? "training" : "test"), MaxItem+1);
++    
++    if (ModelSuffix == 0)
++      sprintf(suffixbuf,".labs");
++    else
++      sprintf(suffixbuf,"%s.labs",ModelSuffix);
++    WriteLabs(suffixbuf);
++
++
++    exit(0);
++}
++
++
++
++
+diff -Nu ../c45rel8/R8/Src/bconsultr.1 ./bconsultr.1
+--- ../c45rel8/R8/Src/bconsultr.1	Thu Jan  1 01:00:00 1970
++++ ./bconsultr.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,69 @@
++.\" troff -man %
++.\"
++.\" DO NOT EDIT
++.\"
++.\" This manual page is automatically generated by class2man.
++.\"
++.ds sV Mar 16, 1999
++.ds sC bconsultr
++.ds sS 1
++.TH "\*(sC" "\*(sS" "\*(sV" "" ""
++.PP
++.SH "NAME"
++bconsultr \- 
++Batch classify instances using C4.5 rules
++.SH "SYNOPSIS"
++.nf
++\f(CO
++bconsultr [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>]
++\fP
++.fi
++.PP
++.SH "DESCRIPTION"
++This program allows the creation of a file containing class
++labels from a \f(CO.data\fP or a \f(CO.test\fP file and \f(CO.rules\fP file previously
++generated with the \f(COc4.5rules\fP program. The class labels will be stored
++into a file that has extension \f(CO.labs\fP.
++.PP
++.SH "ARGUMENTS"
++The program takes the following command-line arguments:
++.nf
++\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
++\f(CO-M<name>\fP: Add the given name to the filestem for the 
++    files containing the rules (fstem.rules)
++    and the file that will contain the class labels
++    (fstem.labs)  (default: empty)
++\f(CO-l\fP: Use the training data (fstem.data), not the
++    test data (fstem.test).
++\f(CO-v<n>\fP: Verbosity level (default: 0)
++\f(CO-t<n>\fP: Also print the rules (default: don't)
++\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
++    If this paramter is not give, the classic C4.5
++    scheme is used: the last attribute in the data file
++    contains the class label and the names file contains
++    the list of allowed class labels as its first entry.
++    If this parameter is given, any discrete attribute 
++    in the data file can be used as class attribute.
++    The names file must contain an attribute description
++    entry for all attribues, and must not contain the
++    initial entry describing the class labels (the class
++    labels are now described in the corresponding attribute
++    description entry)
++\f(CO-h\fP: Show help information about valid options
++.fi
++.PP
++.SH "DATE"
++$Date: 1999/03/10 19:55:11 $
++.PP
++.SH "NOTES"
++Note that the input file has to contain the attribute for 
++the class labels, even though its contents will not be used.
++The attribute must only contain values allowed as described
++in the names file, or missing value indicators (quetsion marks).
++.PP
++.SH "VERSION"
++$Revision: 1.7 $
++.PP
++.SH "AUTHOR(S)"
++Johann Petrak using big portions of the original code by 
++J.R. Quinlan
+diff -Nu ../c45rel8/R8/Src/bconsultr.c ./bconsultr.c
+--- ../c45rel8/R8/Src/bconsultr.c	Thu Jan  1 01:00:00 1970
++++ ./bconsultr.c	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,322 @@
++/*************************************************************************/
++/*									 */
++/*  Generate labels for test cases using pre-generated rules     	 */
++/*  -----------------------------------------------------------------	 */
++/*									 */
++/*************************************************************************/
++
++/* the following comment follows the formatting conventions
++   of the OSE developmnet tools to allow automatic 
++   creation of man pages
++*/
++
++/*
++// [bconsultr]
++//
++// = FILENAME
++//   bconsultr.c
++//
++// = AUTHOR(S)
++//   Johann Petrak using big portions of the original code by 
++//   J.R. Quinlan
++//
++// = TITLE
++//   Batch classify instances using C4.5 rules
++//
++// = DESCRIPTION
++//   This program allows the creation of a file containing class
++//   labels from a <.data> or a <.test> file and <.rules> file previously
++//   generated with the <c4.5rules> program. The class labels will be stored
++//   into a file that has extension <.labs>.
++//
++// = SYNOPSIS
++//   bconsultr [-f\<fstem\>] [-M\<name\>] [-u] [-l] [-v\<n\>] [-t] [-T\<n\>]
++//
++// = ARGUMENTS
++//   The program takes the following command-line arguments:
++// = BEGIN<NOFILL>
++//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
++//   <-M\<name\>>: Add the given name to the filestem for the 
++//       files containing the rules (fstem.rules)
++//       and the file that will contain the class labels
++//       (fstem.labs)  (default: empty)
++//   <-l>: Use the training data (fstem.data), not the
++//       test data (fstem.test).
++//   <-v\<n\>>: Verbosity level (default: 0)
++//   <-t\<n\>>: Also print the rules (default: don't)
++//   <-T\<n\>>: Specify target attribute number (counting from 1).
++//       If this paramter is not give, the classic C4.5
++//       scheme is used: the last attribute in the data file
++//       contains the class label and the names file contains
++//       the list of allowed class labels as its first entry.
++//       If this parameter is given, any discrete attribute 
++//       in the data file can be used as class attribute.
++//       The names file must contain an attribute description
++//       entry for all attribues, and must not contain the
++//       initial entry describing the class labels (the class
++//       labels are now described in the corresponding attribute
++//       description entry)
++//   <-h>: Show help information about valid options
++//   
++// = END<NOFILL>
++//
++// = NOTES
++//   Note that the input file has to contain the attribute for 
++//   the class labels, even though its contents will not be used.
++//   The attribute must only contain values allowed as described
++//   in the names file, or missing value indicators (quetsion marks).
++//
++// = VERSION
++//   $Revision: 1.8 $
++//
++// = DATE
++//   $Date: 1999/03/16 16:37:42 $
++//
++// = COPYRIGHT
++//   Copyright (1997) Austrian Research Institute
++//   for Artificial Intelligence, Vienna, Austria
++//
++//===============
++
++
++ */
++
++#include "defns.i"
++#include "types.i"
++char suffixbuf[256];
++unsigned int NrMVClass = 0;
++
++static char * rcsid = "@(#)$Id: bconsultr.c,v 1.8 1999/03/16 16:37:42 johann Exp $";
++
++	/*  External data.  Note: uncommented variables have the same meaning
++	    as for decision trees  */
++
++short		MaxAtt, MaxClass, MaxDiscrVal,
++                IGNOREMVCLASS = 1;
++
++ItemNo		MaxItem, TARGETCOLUMN = 0;
++
++Description	*Item;
++
++DiscrValue	*MaxAttVal;
++
++char		*SpecialStatus;
++
++String		*ClassName,
++                *ClassAttr,
++		*AttName,
++		**AttValName,
++                ModelSuffix = 0,
++		FileName = "DF";
++
++short		VERBOSITY = 0,
++		TRIALS;
++
++Boolean		TRACE	  = false;
++
++Boolean         PRINTTREE = true;
++
++Boolean		UNSEENS	  = false,
++                TRAIN      = false,
++		SIGTEST	  = false,	/* use significance test in rule pruning */
++		SIMANNEAL = false;	/* use simulated annealing */
++
++float		SIGTHRESH   = 0.05,
++		CF	    = 0.25,
++		REDUNDANCY  = 1.0;	/* factor that guesstimates the
++					   amount of redundancy and
++					   irrelevance in the attributes */
++
++PR		*Rule;			/* current rules */
++
++RuleNo		NRules = 0,		/* number of current rules */
++		*RuleIndex;		/* rule index */
++
++short		RuleSpace = 0;		/* space allocated for rules */
++
++ClassNo		DefaultClass;		/* current default class */
++
++RuleSet		*PRSet;			/* sets of rulesets */
++
++float		AttTestBits,		/* bits to encode tested att */
++		*BranchBits;		/* ditto attribute value */
++
++
++char suffixbuf[256];
++
++float	Confidence;		/* certainty factor of fired rule */
++				/* (set by BestRuleInd) */
++
++
++ItemNo Interp(Extension)
++  String Extension;
++/*     ---------  */
++{
++  char Fn[500];
++  FILE *TRf = 0;
++  ItemNo i, Tested=0, Errors=0, *ConfusionMat;
++  ClassNo AssignedClass;
++  RuleNo p, ri, BestRuleInd();
++  float ErrorRate, BestRuleConfidence;
++  
++  strcpy(Fn, FileName);
++  strcat(Fn, Extension);
++  
++  if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
++
++  ConfusionMat = (ItemNo *) calloc((MaxClass+1)*(MaxClass+1), sizeof(ItemNo));
++  
++  ForEach(i, 0, MaxItem)
++    {
++      /*  Find first choice for rule for this item  */
++      
++      ri = BestRuleInd(Item[i], 1);
++      if (ri != 0)
++	AssignedClass =  Rule[ri].Rhs;
++      else
++	AssignedClass = DefaultClass;
++      
++      if (AssignedClass != Class(Item[i])) Errors++;
++      
++      fprintf(TRf,"%s\n",ClassName[AssignedClass]);
++      
++      ConfusionMat[Class(Item[i])*(MaxClass+1)+AssignedClass]++;
++      
++      Tested++;
++      
++    }
++  
++  fclose(TRf);
++  
++  printf("\nTested %d, errors %d (%.1f%%)\n",
++	 Tested, Errors, 100 * Errors / (float) Tested);
++  
++  PrintConfusionMatrix(ConfusionMat);
++  free(ConfusionMat);
++  
++  return Errors;
++}
++
++RuleNo BestRuleInd(CaseDesc, Start)
++/*     ---------------  */
++    Description CaseDesc;
++    RuleNo Start;
++{
++    RuleNo r, ri;
++    float Strength();
++
++    ForEach(ri, Start, NRules)
++    {
++	Confidence = Strength(Rule[ri], CaseDesc);
++
++	if ( Confidence > 0.1 )
++	{
++	    return ri;
++	}
++    }
++
++    Confidence = 0.0;
++    return 0;
++}
++
++
++    main(Argc, Argv)
++/*  ----  */
++    int Argc;
++    char *Argv[];
++{
++    int o;
++    extern char *optarg;
++    extern int optind;
++    Boolean FirstTime=true;
++    RuleNo r;
++
++    PrintHeader("label from rules generator");
++
++    /*  Process options  */
++
++    while ( (o = getopt(Argc, Argv, "f:v:tT:M:hl")) != EOF )
++    {
++	if ( FirstTime )
++	{
++	    printf("\n    Options:\n");
++	    FirstTime = false;
++	}
++
++	switch (o)
++	{
++	    case 'f':	FileName = optarg;
++			printf("\tFile stem <%s>\n", FileName);
++			break;
++	    case 'M':   ModelSuffix = optarg;
++		        printf("\tModel name <%s>\n", ModelSuffix);
++	    	        break;
++	    case 'v':	VERBOSITY = atoi(optarg);
++			printf("\tVerbosity level %d\n", VERBOSITY);
++			break;
++	case 'l':   TRAIN = true;
++		    printf("\tUse training (learning) set\n", VERBOSITY);
++		    break;
++	    case 't':	TRACE = true;
++			printf("\tShow rules used for labelling\n");
++			break;
++   	    case 'T':   TARGETCOLUMN = atoi(optarg);
++		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++		        break;
++	  case 'h': printf("usage: %s [options]\n", Argv[0]);
++	            printf("  options: [-f<fstem>] [-M<name>] [-l] [-v<n>] [-t] [-T<n>] [-I<n>]\n");
++		    printf("  -f<fstem>: filestem (DF)\n");
++		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
++		    printf("  -l:        use training set (test set)\n");
++		    printf("  -v<n>:     verbosity level (0)\n");
++		    printf("  -t:        print rules (dont)\n");
++		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
++		    printf("  -h:        show this help info\n");
++		    printf("\n\n  The program will create a file <fstem>.labs that contains\n  the assigned class labels, one in each row\n");
++		    exit(1);
++		    break;
++	    case '?':	printf("unrecognised option\n");
++			exit(1);
++	}
++    } 
++
++    /*  Initialise  */
++
++    GetNames();
++    GetData(TRAIN ? ".data" : ".test");
++    printf("\nRead %d cases (%d attributes) from %s.%s\n",
++	   MaxItem+1, MaxAtt+1, FileName, (TRAIN ? "data" : "test"));
++
++    if (IGNOREMVCLASS == 1)
++      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
++    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
++      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
++
++
++    GetRules();
++
++    if ( TRACE )
++    {
++	ForEach(r, 1, NRules)
++	{
++	    PrintRule(r);
++	}
++	printf("\nDefault class: %s\n", ClassName[DefaultClass]);
++    }
++
++
++
++    printf("\nGenerate labels file from %s data (%d items):\n", 
++	   (TRAIN ? "training" : "test"), MaxItem+1);
++    
++    if (ModelSuffix == 0)
++      sprintf(suffixbuf,".labs");
++    else
++      sprintf(suffixbuf,"%s.labs",ModelSuffix);
++
++    Interp(suffixbuf);
++
++
++    exit(0);
++}
++
+diff -Nu ../c45rel8/R8/Src/besttree.c ./besttree.c
+--- ../c45rel8/R8/Src/besttree.c	Fri Feb 28 23:52:09 2003
++++ ./besttree.c	Fri Feb 28 23:52:09 2003
+@@ -10,13 +10,14 @@
+ #include "types.i"
+ #include "extern.i"
+ 
++static char * rcsid = "@(#)$Id: besttree.c,v 1.5 1999/03/10 17:04:06 johann Exp $";
++
+ 
+ ItemNo		*TargetClassFreq;
+ Tree		*Raw;
+ extern Tree	*Pruned;
+ 
+ 
+-
+ /*************************************************************************/
+ /*									 */
+ /*	Grow and prune a single tree from all data			 */
+@@ -41,7 +42,7 @@
+     printf("\n");
+     PrintTree(Raw[0]);
+ 
+-    SaveTree(Raw[0], ".unpruned");
++    SaveTree(Raw[0],".unpruned");
+ 
+     Pruned[0] = CopyTree(Raw[0]);
+     if ( Prune(Pruned[0]) )
+diff -Nu ../c45rel8/R8/Src/build.c ./build.c
+--- ../c45rel8/R8/Src/build.c	Fri Feb 28 23:52:09 2003
++++ ./build.c	Fri Feb 28 23:52:09 2003
+@@ -10,6 +10,7 @@
+ #include "types.i"
+ #include "extern.i"
+ 
++static char * rcsid = "@(#)$Id: build.c,v 1.4 1999/03/10 17:04:07 johann Exp $";
+ 
+ ItemCount
+ 	*Weight,	/* Weight[i]  = current fraction of item i */
+diff -Nu ../c45rel8/R8/Src/c4.5.1 ./c4.5.1
+--- ../c45rel8/R8/Src/c4.5.1	Thu Jan  1 01:00:00 1970
++++ ./c4.5.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,209 @@
++.TH C4.5 1
++.SH NAME
++.PP
++c4.5 \- form a decision tree from a file of examples
++.SH SYNOPSIS
++.PP
++.B c4.5
++[ \fB-f\fR filestem ]
++[ \fB-u\fR ]
++[ \fB-s\fR ]
++[ \fB-p\fR ]
++[ \fB-v\fR verb ]
++[ \fB-t\fR trials ]
++   [ \fB-w\fR wsize ]
++[ \fB-i\fR incr ]
++[ \fB-g\fR ]
++[ \fB-m\fR minobjs ]
++[ \fB-c\fR cf ]
++.SH NOTE
++.PP
++For info on the additions and mdifications included in the OeFAI
++version of 
++.I C4.5
++please see
++.I man c4.5oefai
++.SH DESCRIPTION
++.PP
++.I C4.5
++is a program for inducing classification rules in the form
++of decision trees from a set of given examples.
++.PP
++All files read and written by C4.5 are of the form
++.I filestem.ext
++where
++.I filestem
++is a file name stem that identifies the induction task and
++.I ext
++is an extension that defines the type of file.
++The program expects to find at least 
++two files: a
++.B names file
++.I filestem.names
++defining class, attribute and attribute value names, and a
++.B data file
++.I filestem.data
++containing a set of objects, each of which is described by its
++values of each of the attributes and its class.
++.PP
++The program can generate trees
++in two ways.  In
++.I batch
++mode (the default), the program generates a single tree
++using all the available data.
++In
++.I iterative
++mode,
++the program starts with a randomly-selected subset of the
++data (the
++.I window),
++generates a trial decision tree, adds some misclassified
++objects, and continues until the trial decision tree
++correctly classifies all objects not in the window or
++until it appears that no progress is being made.
++Since iterative mode starts with a randomly-selected subset,
++multiple trials with the same data can be used to generate
++more than one tree.
++.PP
++All trees generated in the process are saved in
++.I filestem.unpruned.
++After each tree is generated, it is
++.I pruned
++in an attempt to simplify it.
++The `best' pruned tree (selected by the program if more there is
++more than one trial)
++is saved in machine-readable form in
++.I filestem.tree.
++.PP
++All trees produced, both pre- and post-simplification, are evaluated
++on the training data.  If required, they can also be evaluated
++on unseen data in file
++.I filestem.test.
++
++.SH FILE FORMATS
++The
++.B names file
++.I filestem.names
++is a series of entries defining names of attributes,
++attribute values and classes.  The file is free-format
++with the exception that the vertical bar `|' causes the
++remainder of that line to be ignored.
++Each entry is terminated by a period which may be
++omitted if it is the last character of a line.
++.PP
++The file
++commences with the names of the classes, separated by
++commas and terminated with a period.  Each name consists of
++a string of characters that does not include comma, question mark
++or colon (unless preceded by a backslash).  A period may be
++embedded in a name provided it is not followed by a space.
++Embedded spaces are also permitted but multiple whitespace is
++replaced by a single space.
++The rest of the file consists of a single entry for each
++attribute.  An attribute entry begins with the attribute name
++followed by a colon, and then either the word `ignore' (indicating
++that this attribute should not be used), the word `continuous'
++(indicating that the attribute has real values),
++the word `discrete' followed by an integer
++.I n
++(indicating that the program should assemble
++a list of up to
++.I n
++possible values), or a list
++of all possible discrete values separated by commas.  (The latter
++form for discrete attributes is recommended as it
++enables input to be checked.)  Each
++entry is terminated with a period (but see above).
++.PP
++The
++.B data file
++.I filestem.data
++contains one line per object.  Each line contains
++the values of the attributes in order followed by the
++object's class, with all entries separated by commas.
++The rules for valid names in the
++.B names file
++also hold for the names in the
++.B data file.
++An unknown value of an attribute is indicated by a
++question mark `?'.
++If a 
++.B test file
++.I filestem.test
++is used, it has the same format as the data file.
++
++.SH OPTIONS
++Options and their meanings are:
++.PP
++.TP 12
++.BI \-f filestem\^
++Specify the filename stem (default
++.B DF)
++.TP
++.B \-u
++Evaluate trees produced on unseen cases in file 
++.I filestem.test.
++.TP
++.B \-s
++Force `subsetting' of all tests based on discrete attributes
++with more than two values.  C4.5 will construct a test with
++a subset of values associated with each branch.
++.TP
++.B \-p
++Probabilistic thresholds used for continuous attributes (see Quinlan, 1987a).
++.TP
++.BI \-t trials\^
++Set iterative mode with specified number of trials.
++.TP
++.BI \-v verb\^
++Set the verbosity level [0-3] (default 0).
++This option generates more voluminous output that may help to
++explain what the program is doing (but don't count on it);
++see the manual entry for
++.I verbose.
++.PP
++The following options are also available but need not
++be used except for experimentation with tree construction:
++.TP 12
++.BI \-w wsize\^
++Set the size of the initial window
++(default is the maximum of 20 percent and twice the square
++root of the number of data objects).
++.TP
++.BI \-i incr\^
++Set the maximum number of objects that can be
++added to the window at each iteration
++(default is 20 percent of the initial window size).
++.TP
++.B \-g
++Use the gain criterion to select tests.  The default
++uses the gain ratio criterion.
++.TP
++.BI \-m minobjs\^
++In all tests, at least two branches must contain a minimum number
++of objects (default 2).  This option allows the minimum
++number to be altered.
++.TP
++.BI \-c cf\^
++Set the pruning confidence level (default 25%).
++.SH FILES
++.PP
++.in 8
++c4.5
++.br
++filestem.data
++.br
++filestem.names
++.br
++filestem.unpruned  (unpruned trees)
++.br
++filestem.tree   (final decision tree)
++.br
++filestem.test   (unseen data)
++.in 0
++.PP
++.SH SEE ALSO
++.PP
++c4.5oefai(1), c4.5showtree(1), bconsult(1), c4.5rules(1), consult(1)
++.PP
++.SH BUGS
+diff -Nu ../c45rel8/R8/Src/c4.5.c ./c4.5.c
+--- ../c45rel8/R8/Src/c4.5.c	Fri Feb 28 23:52:09 2003
++++ ./c4.5.c	Sat Mar 15 10:36:40 2003
+@@ -5,14 +5,119 @@
+ /*									 */
+ /*************************************************************************/
+ 
++/* the following comment follows the formatting conventions
++   of the OSE developmnet tools to allow automatic 
++   creation of man pages
++*/
++
++/*
++// [c45oefai]
++//
++// = FILENAME
++//   c4.5.c
++//
++// = AUTHOR(S)
++//   J.R. Quinlan, modifications by Johann Petrak
++//
++// = TITLE
++//   OEFAI modifications and additions to the C4.5 program
++//
++// = DESCRIPTION
++//   This is the modified version of C4.5, release 8.
++//   The most important changes
++//   and additions to the original program are:
++// = BEGIN<NOFILL>
++//   - Added option -h to show a short summary of allowed options
++//   - Enhanced portability: now also compiles under DOS 
++//     (tested with CygWin32 and MSVC++ 5.0)
++//   - Added option -M to allow to handle several tree/rule files
++//     together with one data file (see arguments)
++//   - Added option -I to specify how to process missing values
++//     that occur in the target attribute
++//   - Added option -S that will suppress output of the trees
++//   - Added versioning for the sources - to determine the versions
++//     used for a binary use 'ident binfile' or 'what binfile'
++//   - Changed the internal representation for missing value of
++//     continuous fields from -999 to <FLT_MIN>
++//   - Slightly changed the way class confusion matrices are 
++//     printed: zero entries are printed as a zero, not
++//     being left blank as before.
++//   - Added the -O option to deliberately generate an unpruned 
++//     tree (which is written to the <.tree> file) 
++// = END<NOFILL>
++//
++// = SYNOPSIS
++//   c4.5  [-f\<fstem\>] [-b] [-u] [-p] [-v\<n\>] [-t\<n\>] [-w\<w\>] 
++//         [-i\<n\>] [-g] [-s] [-m\<n\>] [-c\<n\>] [-S] [-O]
++//         [-T\<n\>] [-M\<name\>] [-I\<n\>] [-h] 
++//
++// = ARGUMENTS
++//   The program takes the following command-line arguments 
++//   (defaults in parenteses):
++// = BEGIN<NOFILL>
++//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
++//   <-b>: windowing disabled (this is the default)
++//   <-u>: evaluate on unseens in <fstem>.test (no)
++//   <-p>: use probability thresholds (dont use)
++//   <-v\<n\>>: verbosity level (0)
++//   <-t\<n\>>: windowing with n trials (10 if enabled)
++//   <-w\<n\>>: windowing size (20percent of training if windowing enabled)
++//   <-i\<n\>>: windowing increment (20percent of training if windowing enabled)
++//   <-g>: use gain criterion (dont, use gain ratio)
++//   <-s>: use value subsets (dont)
++//   <-m\<n\>>: minimum cases in 2 different branches  (2)
++//   <-c\<n\>>: confidence (25)
++//   <-S>: suppress printing of trees (dont suppress)
++//   <-O>: overfit, do not prune (prune)
++//   <-T\<n\>>: Specify target attribute number (counting from 1).
++//       If this paramter is not give, the classic C4.5
++//       scheme is used: the last attribute in the data file
++//       contains the class label and the names file contains
++//       the list of allowed class labels as its first entry.
++//       If this parameter is given, any discrete attribute 
++//       in the data file can be used as class attribute.
++//       The names file must contain an attribute description
++//       entry for all attribues, and must not contain the
++//       initial entry describing the class labels (the class
++//       labels are now described in the corresponding attribute
++//       description entry)
++//   <-M\<name\>>: Add the given name to the filestem for the 
++//       files containing the trees (fstem.tree, fstem.unpruned).
++//   <-I\<n\>>: n=1: ignore records w/ MV in class
++//       n=2: substitute first class label  (treat as error)
++//   <-h>: Show help information about valid options
++//   
++// = END<NOFILL>
++//
++// = VERSION
++//   $Revision: 1.11 $
++//
++// = DATE
++//   $Date: 1999/03/16 16:37:44 $
++//
++// = COPYRIGHT
++//   Copyright (1997) Austrian Research Institute
++//   for Artificial Intelligence, Vienna, Austria
++//
++//===============
++
++
++ */
++
++
++
+ 
+ #include "defns.i"
+ #include "types.i"
+ 
++static char * rcsid = "@(#)$Id: c4.5.c,v 1.11 1999/03/16 16:37:44 johann Exp $";
+ 
+-    /*  External data, described in extern.i  */
++    /*  External data, described in extern.i   */
+ 
+ short		MaxAtt, MaxClass, MaxDiscrVal = 2;
++short           IGNOREMVCLASS  = 0;
++
++unsigned int NrMVClass = 0;
+ 
+ ItemNo		MaxItem;
+ 
+@@ -23,8 +128,10 @@
+ char		*SpecialStatus;
+ 
+ String		*ClassName,
++                *ClassAttr,
+ 		*AttName,
+ 		**AttValName,
++                ModelSuffix = 0;
+ 		FileName = "DF";
+ 
+ short		VERBOSITY = 0,
+@@ -34,11 +141,14 @@
+ 		SUBSET     = false,
+ 		BATCH      = true,
+ 		UNSEENS    = false,
+-		PROBTHRESH = false;
++		PROBTHRESH = false,
++		PRINTTREE  = true,
++                PRUNETREE  = true;
+ 
+ ItemNo		MINOBJS   = 2,
+ 		WINDOW    = 0,
+-		INCREMENT = 0;
++                TARGETCOLUMN = 0,
++                INCREMENT = 0;
+ 
+ float		CF = 0.25;
+ 
+@@ -47,24 +157,27 @@
+ Boolean		AllKnown = true;
+ 
+ 
++char suffixbuf[256];
++
++
+     main(Argc, Argv)
+ /*  ----  */
+     int Argc;
+     char *Argv[];
+ {
+-    int o;
++    int o;   
+     extern char *optarg;
+     extern int optind;
+     Boolean FirstTime=true;
+     short Best, BestTree();
+ 
+-    PrintHeader("decision tree generator");
++    PrintHeader("(OFAI) decision tree generator");
+ 
+     /*  Process options  */
+ 
+-    while ( (o = getopt(Argc, Argv, "f:bupv:t:w:i:gsm:c:")) != EOF )
++    while ( (o = getopt(Argc, Argv, "f:bupv:t:w:i:gsm:c:SOT:I:hM:")) != EOF )
+     {
+-	if ( FirstTime )
++	if ( FirstTime && o != 'h')
+ 	{
+ 	    printf("\n    Options:\n");
+ 	    FirstTime = false;
+@@ -75,6 +188,9 @@
+ 	case 'f':   FileName = optarg;
+ 		    printf("\tFile stem <%s>\n", FileName);
+ 		    break;
++	case 'M':   ModelSuffix = optarg;
++		    printf("\tModel name <%s>\n", ModelSuffix);
++		    break;
+ 	case 'b':   BATCH = true;
+ 		    printf("\tWindowing disabled (now the default)\n");
+ 		    break;
+@@ -116,14 +232,60 @@
+ 		    break;
+ 	case 'c':   CF = atof(optarg);
+ 		    printf("\tPruning confidence level %g%%\n", CF);
+-		    Check(CF, Epsilon, 100);
++		    Check(CF, 0, 100);
+ 		    CF /= 100;
+ 		    break;
+-	case '?':   printf("unrecognised option\n");
++	case 'S':   PRINTTREE = false;
++		    printf("\tSuppress printing of decision tree(s)\n");
++		    break;
++	case 'O':   PRUNETREE = false;
++		    printf("\tSuppress pruning (Overfit)\n");
++		    break;
++	case 'T':   TARGETCOLUMN = atoi(optarg);
++		    printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++		    break;
++	case 'I':   IGNOREMVCLASS = atoi(optarg);
++	            if (IGNOREMVCLASS == 0)
++		      printf("\tStandard handling of MVs as class values\n");
++		    else if  (IGNOREMVCLASS == 1)
++		      printf("\tIgnore cases with MV as class value\n");
++		    else if  (IGNOREMVCLASS == 2)
++		      printf("\tSubstitute first class label instead of MVs\n");
++		    else {
++		      printf("%s not a valid argument for option -I\n",optarg);
++		      exit(1);
++		    }
++		    break;
++	  case 'h': printf("usage: %s [options]\n", Argv[0]);
++	            printf("  options: [-f<fstem>] [-b] [-u] [-p] [-v<n>] [-t<n>] [-w<w>] [-i<n>]\n");
++		    printf("           [-g] [-s] [-m<n>] [-c<n>] [-S] [-O] [-T<n>] [-M<name>] [-I<n>] [-h]\n");
++		    printf("  -f<fstem>: filestem (DF)\n");
++		    printf("  -b:        windowing disabled (this is the default)\n");
++		    printf("  -u:        evaluate on unseens in <fstem>.test (false)\n");
++		    printf("  -p:        use probability thresholds (dont)\n");
++		    printf("  -v<n>:     verbosity level (0)\n");
++		    printf("  -t<n>:     windowing with n trials (10 if enabled)\n");
++		    printf("  -w<n>:     windowing size (20%% of training if windowing enabled)\n");
++		    printf("  -i<n>:     windowing increment (20%% of training if windowing enabled)\n");
++		    printf("  -g:        use gain criterion (dont, use gain ratio)\n");
++		    printf("  -s:        sue value subsets (dont)\n");
++		    printf("  -m<n>:     minimum cases in 2 branches  (2)\n");
++		    printf("  -c<n>:     confidence (25)\n");
++		    printf("  -S:        suppress printing of trees (dont suppress)\n");
++		    printf("  -O:        overfit, do not prune (prune)\n");
++		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
++		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
++		    printf("  -I<n>:     n=0: treat MV in class as error (default)\n");
++		    printf("             n=1: ignore records w/ MV in class\n");
++		    printf("             n=2: substitute first class label  (treat as error)\n");
++		    printf("  -h:        show this help info\n");
++		    exit(1);
++		    break;
++	case '?':   printf("unrecognised option (use -h for help)\n");
+ 		    exit(1);
+ 	}
+     }
+-
++    
+     /*  Initialise  */
+ 
+     GetNames();
+@@ -131,8 +293,12 @@
+     printf("\nRead %d cases (%d attributes) from %s.data\n",
+ 	   MaxItem+1, MaxAtt+1, FileName);
+ 
++    if (IGNOREMVCLASS == 1)
++      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
++    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
++      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
+     /*  Build decision trees  */
+-
++    
+     if ( BATCH )
+     {
+ 	TRIALS = 1;
+diff -Nu ../c45rel8/R8/Src/c4.5oefai.1 ./c4.5oefai.1
+--- ../c45rel8/R8/Src/c4.5oefai.1	Thu Jan  1 01:00:00 1970
++++ ./c4.5oefai.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,86 @@
++.ds sV Mar 16, 1999
++.ds sC c45oefai
++.ds sS 1
++.TH "\*(sC" "\*(sS" "\*(sV" "" ""
++.PP
++.SH "NAME"
++c45oefai \- 
++OEFAI modifications and additions to the C4.5 program
++.SH "SYNOPSIS"
++.nf
++\f(CO
++c4.5  [-f<fstem>] [-b] [-u] [-p] [-v<n>] [-t<n>] [-w<w>] 
++      [-i<n>] [-g] [-s] [-m<n>] [-c<n>] [-S] [-O]
++      [-T<n>] [-M<name>] [-I<n>] [-h] 
++\fP
++.fi
++.PP
++.SH "DESCRIPTION"
++This is the modified version of C4.5, release 8.
++The most important changes
++and additions to the original program are:
++.nf
++- Added option -h to show a short summary of allowed options
++- Enhanced portability: now also compiles under DOS 
++  (tested with CygWin32 and MSVC++ 5.0)
++- Added option -M to allow to handle several tree/rule files
++  together with one data file (see arguments)
++- Added option -I to specify how to process missing values
++  that occur in the target attribute
++- Added option -S that will suppress output of the trees
++- Added versioning for the sources - to determine the versions
++  used for a binary use 'ident binfile' or 'what binfile'
++- Changed the internal representation for missing value of
++  continuous fields from -999 to \f(COFLT_MIN\fP
++- Slightly changed the way class confusion matrices are 
++  printed: zero entries are printed as a zero, not
++  being left blank as before.
++- Added the -O option to deliberately generate an unpruned 
++  tree (which is written to the \f(CO.tree\fP file) 
++.fi
++.PP
++.SH "ARGUMENTS"
++The program takes the following command-line arguments 
++(defaults in parenteses):
++.nf
++\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
++\f(CO-b\fP: windowing disabled (this is the default)
++\f(CO-u\fP: evaluate on unseens in \f(COfstem\fP.test (no)
++\f(CO-p\fP: use probability thresholds (dont use)
++\f(CO-v<n>\fP: verbosity level (0)
++\f(CO-t<n>\fP: windowing with n trials (10 if enabled)
++\f(CO-w<n>\fP: windowing size (20percent of training if windowing enabled)
++\f(CO-i<n>\fP: windowing increment (20percent of training if windowing enabled)
++\f(CO-g\fP: use gain criterion (dont, use gain ratio)
++\f(CO-s\fP: use value subsets (dont)
++\f(CO-m<n>\fP: minimum cases in 2 different branches  (2)
++\f(CO-c<n>\fP: confidence (25)
++\f(CO-S\fP: suppress printing of trees (dont suppress)
++\f(CO-O\fP: overfit, do not prune (prune)
++\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
++    If this paramter is not give, the classic C4.5
++    scheme is used: the last attribute in the data file
++    contains the class label and the names file contains
++    the list of allowed class labels as its first entry.
++    If this parameter is given, any discrete attribute 
++    in the data file can be used as class attribute.
++    The names file must contain an attribute description
++    entry for all attribues, and must not contain the
++    initial entry describing the class labels (the class
++    labels are now described in the corresponding attribute
++    description entry)
++\f(CO-M<name>\fP: Add the given name to the filestem for the 
++    files containing the trees (fstem.tree, fstem.unpruned).
++\f(CO-I<n>\fP: n=1: ignore records w/ MV in class
++    n=2: substitute first class label  (treat as error)
++\f(CO-h\fP: Show help information about valid options
++.fi
++.PP
++.SH "DATE"
++$Date: 1999/03/10 19:55:12 $
++.PP
++.SH "VERSION"
++$Revision: 1.10 $
++.PP
++.SH "AUTHOR(S)"
++J.R. Quinlan, modifications by Johann Petrak
+diff -Nu ../c45rel8/R8/Src/c4.5rules.1 ./c4.5rules.1
+--- ../c45rel8/R8/Src/c4.5rules.1	Thu Jan  1 01:00:00 1970
++++ ./c4.5rules.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,109 @@
++.EN
++.TH C4.5 1
++.SH NAME
++.PP
++c4.5rules \- form production rules from unpruned decision trees
++.SH SYNOPSIS
++.PP
++.B c4.5rules
++[ \fB-f\fR filestem ]
++[ \fB-u\fR ]
++[ \fB-v\fR verb ]
++[ \fB-F\fR siglevel ]
++[ \fB-c\fR cf ]
++[ \fB-r\fR redundancy ]
++.SH NOTE
++.PP
++For info on the additions and mdifications included in the OeFAI
++version of 
++.I C4.5rules
++please see
++.I man c4.5rulesoefai
++.SH DESCRIPTION
++.PP
++.I C4.5rules 
++reads the decision tree or trees produced by C4.5 and generates
++a set of production rules from each tree and
++from all trees together.
++All files read and written by C4.5 are of the form
++.I filestem.ext
++where
++.I filestem
++is a file name stem that identifies the induction task and
++.I ext
++is an extension that defines the type of file.
++The Rules program
++expects to find a
++.B names file
++defining class, attribute and attribute value names, a
++.B data file
++containing a set of objects whose class and value of each
++attribute is specified, a
++.B unpruned file
++generated by C4.5 from the
++.B data file,
++and (optionally) a
++.B test file
++containing unseen objects.
++.PP
++For each tree that it finds, the program generates a set of
++pruned rules, and then sifts this set in an attempt to find
++the most useful subset of them.  If more than one tree was
++found, all subsets are then merged and the resulting composite
++set of rules is then sifted.  The final set of rules is saved
++in a machine-readable format in a
++.B rules
++file.
++Each of the rulesets produced is then evaluated on the
++original training data and (optionally) on the test data.
++.PP
++.SH OPTIONS
++.PP
++.TP 12
++.BI \-f filestem\^
++Specify the filename stem (default
++.B DF).
++.TP
++.B \-u
++Evaluate rulesets on unseen cases in file
++.I filestem.test.
++.TP
++.BI \-v verb\^
++Set the verbosity level [0-3] (default 0).
++.TP
++.BI \-F siglevel\^
++Invoke Fisher's significance test when pruning rules.
++If a rule contains a condition whose probability of being irrelevant
++is greater than the stated level, the rule is pruned further
++(default: no significance testing).
++.TP
++.BI \-c cf\^
++Set the confidence level used in forming the pessimistic
++estimate of a rule's error rate (default 25%).
++.TP
++.BI \-r redundancy\^
++If many irrelevant or redundant attributes are included, estimate
++the ratio of attributes to ``sensible'' attributes (default 1).
++.PP
++.SH FILES
++.PP
++.in 8
++c4.5
++.br
++c4.5rules
++.br
++filestem.data
++.br
++filestem.names
++.br
++filestem.unpruned  (unpruned trees)
++.br
++filestem.rules  (production rules)
++.br
++filestem.test   (unseen data)
++.in 0
++.PP
++.SH SEE ALSO
++.PP
++c4.5(1), consultr(1)
++.SH BUGS
+diff -Nu ../c45rel8/R8/Src/c4.5rules.c ./c4.5rules.c
+--- ../c45rel8/R8/Src/c4.5rules.c	Fri Feb 28 23:52:09 2003
++++ ./c4.5rules.c	Fri Feb 28 23:52:09 2003
+@@ -5,17 +5,102 @@
+ /*									 */
+ /*************************************************************************/
+ 
++/* the following comment follows the formatting conventions
++   of the OSE developmnet tools to allow automatic 
++   creation of man pages
++*/
++
++/*
++// [c45rulesoefai]
++//
++// = FILENAME
++//   c4.5rules.c
++//
++// = TITLE
++//   OEFAI modifications and additions to the C4.5rule program
++//
++// = AUTHOR(S)
++//   J.R. Quinlan, modifications and additions by Johann Petrak
++//
++// = DESCRIPTION
++//   This is the modified version of C4.5, release 8.
++//   The most important changes
++//   and additions to the original program are:
++// = BEGIN<NOFILL>
++//   - Added option -h to show a short summary of allowed options
++//   - Enhanced portability: now also compiles under DOS 
++//     (tested with CygWin32 and MSVC++ 5.0)
++//   - Added options -M, -I, -T, -S: see c4.5
++// = END<NOFILL>
++//
++// = SYNOPSIS
++//   c4.5  [-f\<fstem\>] [-u] [-r\<n\>] [-v\<n\>] [-F\<n\>] [-c\<n\>]
++//    [-s]  [-S] [-T\<n\>] [-M\<name\>] [-I\<n\>] [-h] 
++//
++// = ARGUMENTS
++//   The program takes the following command-line arguments 
++//   (defaults in parenteses):
++// = BEGIN<NOFILL>
++//   <-f\<filestem\>>: Filestem of data/names file to use (as with c4.5)
++//   <-u>: evaluate on unseens in <fstem>.test (no)
++//   <-r\<n\>>: redundancy factor (1.0)
++//   <-v\<n\>>: verbosity level (0)
++//   <-F\<n\>>: exact Fisher test significance level
++//       (don't use exact Fisher test)
++//   <-c\<n\>>: pruning confidence (25\%)
++//   <-S>: suppress printing of trees (dont suppress)
++//   <-T\<n\>>: Specify target attribute number (counting from 1).
++//       If this paramter is not give, the classic C4.5
++//       scheme is used: the last attribute in the data file
++//       contains the class label and the names file contains
++//       the list of allowed class labels as its first entry.
++//       If this parameter is given, any discrete attribute 
++//       in the data file can be used as class attribute.
++//       The names file must contain an attribute description
++//       entry for all attribues, and must not contain the
++//       initial entry describing the class labels (the class
++//       labels are now described in the corresponding attribute
++//       description entry)
++//   <-M\<name\>>: Add the given name to the filestem for the 
++//       files containing the trees (fstem.tree, fstem.unpruned).
++//   <-I\<n\>>: n=1: ignore records w/ MV in class
++//       n=2: substitute first class label  (treat as error)
++//   <-h>: Show help information about valid options
++//   
++// = END<NOFILL>
++//
++// = VERSION
++//   $Revision: 1.10 $
++//
++// = DATE
++//   $Date: 1999/03/16 16:37:45 $
++//
++// = COPYRIGHT
++//   Copyright (1997) Austrian Research Institute
++//   for Artificial Intelligence, Vienna, Austria
++//
++//===============
++
++
++
++ */
++
++
+ 
+ #include "defns.i"
+ #include "types.i"
+ 
++static char * rcsid = "@(#)$Id: c4.5rules.c,v 1.10 1999/03/16 16:37:45 johann Exp $";
+ 
+ 	/*  External data.  Note: uncommented variables have the same meaning
+ 	    as for decision trees  */
+ 
++unsigned int NrMVClass = 0;
++
+ short		MaxAtt, MaxClass, MaxDiscrVal;
+ 
+-ItemNo		MaxItem;
++ItemNo		MaxItem,
++                TARGETCOLUMN = 0;
+ 
+ Description	*Item;
+ 
+@@ -24,15 +109,19 @@
+ char		*SpecialStatus;
+ 
+ String		*ClassName,
++                *ClassAttr,
+ 		*AttName,
+ 		**AttValName,
++                ModelSuffix = 0;
+ 		FileName = "DF";
+ 
+ short		VERBOSITY = 0,
++                IGNOREMVCLASS = 0,
+ 		TRIALS;
+ 
+ Boolean		UNSEENS	  = false,
+ 		SIGTEST	  = false,	/* use significance test in rule pruning */
++		PRINTTREE = true,       /* print decision trees/rules */
+ 		SIMANNEAL = false;	/* use simulated annealing */
+ 
+ float		SIGTHRESH   = 0.05,
+@@ -55,6 +144,7 @@
+ float		AttTestBits,		/* bits to encode tested att */
+ 		*BranchBits;		/* ditto attribute value */
+ 
++char suffixbuf[256];
+ 
+ 
+     main(Argc, Argv)
+@@ -67,11 +157,11 @@
+     extern int optind;
+     Boolean FirstTime=true;
+ 
+-    PrintHeader("rule generator");
++    PrintHeader("(OFAI) rule generator");
+ 
+     /*  Process options  */
+ 
+-    while ( (o = getopt(Argc, Argv, "f:uv:c:r:F:a")) != EOF )
++    while ( (o = getopt(Argc, Argv, "f:uv:c:r:F:aT:I:M:Sh")) != EOF )
+     {
+ 	if ( FirstTime )
+ 	{
+@@ -84,6 +174,9 @@
+ 	    case 'f':	FileName = optarg;
+ 			printf("\tFile stem <%s>\n", FileName);
+ 			break;
++	    case 'M':   ModelSuffix = optarg;
++	                printf("\tModel name <%s>\n", ModelSuffix);
++		        break;
+ 	    case 'u':	UNSEENS = true;
+ 			printf("\tRulesets evaluated on unseen cases\n");
+ 			break;
+@@ -109,6 +202,41 @@
+ 	    case 'a':	SIMANNEAL = true;
+ 			printf("\tSimulated annealing for selecting rules\n");
+ 			break;
++	    case 'S':	PRINTTREE = false;
++			printf("\tSuppress printing of rules\n");
++			break;
++	    case 'T':   TARGETCOLUMN = atoi(optarg);
++	                printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++	                break;
++	  case 'I':   IGNOREMVCLASS = atoi(optarg);
++	              if (IGNOREMVCLASS == 0)
++			printf("\tStandard handling of MVs as class values\n");
++		      else if  (IGNOREMVCLASS == 1)
++			printf("\tIgnore cases with MV as class value\n");
++		      else if  (IGNOREMVCLASS == 2)
++			printf("\tSubstitute first class label instead of MVs\n");
++		      else {
++			printf("%s not a valid argument for option -I\n",optarg);
++			exit(1);
++		      }
++		      break;
++	  case 'h': printf("usage: %s [options]\n", Argv[0]);
++	            printf("  options: [-f<fstem>] [-u] [-r<n>] [-v<n>]\n");
++		    printf("           [-c<n>] [-S] [-T<n>] [-M<name>] [-I<n>] [-h]\n");
++		    printf("  -f<fstem>: filestem (DF)\n");
++		    printf("  -r<n>:     redundancy factor (1.0)\n");
++		    printf("  -u:        evaluate on unseens in <fstem>.test (false)\n");
++		    printf("  -F<n>:     exact test significance level (dont use)\n");
++		    printf("  -v<n>:     verbosity level (0)\n");
++		    printf("  -c<n>:     pruning confidence (25)\n");
++		    printf("  -S:        suppress printing of rules (dont suppress)\n");
++		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
++		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
++		    printf("  -I<n>:     n=1: ignore records w/ MV in class\n");
++		    printf("             n=2: substitute first class label  (treat as error)\n");
++		    printf("  -h:        show this help info\n");
++		    exit(1);
++		    break;
+ 	    case '?':	printf("unrecognised option\n");
+ 			exit(1);
+ 	}
+@@ -120,6 +248,10 @@
+     GetData(".data");
+     printf("\nRead %d cases (%d attributes) from %s\n",
+ 	   MaxItem+1, MaxAtt+1, FileName);
++    if (IGNOREMVCLASS == 1)
++      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
++    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
++      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
+ 
+     GenerateLogs();
+ 
+diff -Nu ../c45rel8/R8/Src/c4.5rulesoefai.1 ./c4.5rulesoefai.1
+--- ../c45rel8/R8/Src/c4.5rulesoefai.1	Thu Jan  1 01:00:00 1970
++++ ./c4.5rulesoefai.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,72 @@
++.\" troff -man %
++.\"
++.\" DO NOT EDIT
++.\"
++.\" This manual page is automatically generated by class2man.
++.\"
++.ds sV Mar 16, 1999
++.ds sC c45rulesoefai
++.ds sS 1
++.TH "\*(sC" "\*(sS" "\*(sV" "" ""
++.PP
++.SH "NAME"
++c45rulesoefai \- 
++OEFAI modifications and additions to the C4.5rule program
++.SH "SYNOPSIS"
++.nf
++\f(CO
++c4.5  [-f<fstem>] [-u] [-r<n>] [-v<n>] [-F<n>] [-c<n>]
++ [-s]  [-S] [-T<n>] [-M<name>] [-I<n>] [-h] 
++\fP
++.fi
++.PP
++.SH "DESCRIPTION"
++This is the modified version of C4.5, release 8.
++The most important changes
++and additions to the original program are:
++.nf
++- Added option -h to show a short summary of allowed options
++- Enhanced portability: now also compiles under DOS 
++  (tested with CygWin32 and MSVC++ 5.0)
++- Added options -M, -I, -T, -S: see c4.5
++.fi
++.PP
++.SH "ARGUMENTS"
++The program takes the following command-line arguments 
++(defaults in parenteses):
++.nf
++\f(CO-f<filestem>\fP: Filestem of data/names file to use (as with c4.5)
++\f(CO-u\fP: evaluate on unseens in \f(COfstem\fP.test (no)
++\f(CO-r<n>\fP: redundancy factor (1.0)
++\f(CO-v<n>\fP: verbosity level (0)
++\f(CO-F<n>\fP: exact Fisher test significance level
++    (don't use exact Fisher test)
++\f(CO-c<n>\fP: pruning confidence (25\\%)
++\f(CO-S\fP: suppress printing of trees (dont suppress)
++\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
++    If this paramter is not give, the classic C4.5
++    scheme is used: the last attribute in the data file
++    contains the class label and the names file contains
++    the list of allowed class labels as its first entry.
++    If this parameter is given, any discrete attribute 
++    in the data file can be used as class attribute.
++    The names file must contain an attribute description
++    entry for all attribues, and must not contain the
++    initial entry describing the class labels (the class
++    labels are now described in the corresponding attribute
++    description entry)
++\f(CO-M<name>\fP: Add the given name to the filestem for the 
++    files containing the trees (fstem.tree, fstem.unpruned).
++\f(CO-I<n>\fP: n=1: ignore records w/ MV in class
++    n=2: substitute first class label  (treat as error)
++\f(CO-h\fP: Show help information about valid options
++.fi
++.PP
++.SH "DATE"
++$Date: 1999/03/10 19:55:14 $
++.PP
++.SH "VERSION"
++$Revision: 1.9 $
++.PP
++.SH "AUTHOR(S)"
++J.R. Quinlan, modifications and additions by Johann Petrak
+diff -Nu ../c45rel8/R8/Src/c4.5showrules.1 ./c4.5showrules.1
+--- ../c45rel8/R8/Src/c4.5showrules.1	Thu Jan  1 01:00:00 1970
++++ ./c4.5showrules.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,66 @@
++.\" troff -man %
++.\"
++.\" DO NOT EDIT
++.\"
++.\" This manual page is automatically generated by class2man.
++.\"
++.ds sV Mar 16, 1999
++.ds sC c45showrules
++.ds sS 1
++.TH "\*(sC" "\*(sS" "\*(sV" "" ""
++.PP
++.SH "NAME"
++c45showrules \- 
++Show C4.5 rules and associated instances
++.SH "SYNOPSIS"
++.nf
++\f(CO
++c4.5showrules  [-f<fstem>] [-c] [-u] [-M<name>] [-U] [-T<n>] [-h]
++\fP
++.fi
++.PP
++.SH "DESCRIPTION"
++This program can be used to print rules that were
++previously generated with the c4.5rules program and optionally
++include additional information like 
++node local instance numbers in the printout.
++.PP
++.SH "ARGUMENTS"
++The program takes the following command-line arguments:
++.nf
++\f(CO-f<fstem>\fP: Filestem of data/names file to use (as with c4.5)
++\f(CO-c\fP: Show instance indices (case numbers). This will
++    generate an additional line starting with a hash symbol
++    after each terminal node printed. This line will contain
++    a blank seperated list of case numbers (counting from 0)
++    that go into that node.
++\f(CO-u\fP: Use test data (fstem.test) instead of training data
++    (fstem.data)
++\f(CO-M<name>\fP: Add the given name to the filestem for the 
++    files containing the rules (fstem.rules)
++    and the file that will contain the class labels
++    (fstem.labs)  (default: empty)
++\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
++    If this paramter is not give, the classic C4.5
++    scheme is used: the last attribute in the data file
++    contains the class label and the names file contains
++    the list of allowed class labels as its first entry.
++    If this parameter is given, any discrete attribute 
++    in the data file can be used as class attribute.
++    The names file must contain an attribute description
++    entry for all attribues, and must not contain the
++    initial entry describing the class labels (the class
++    labels are now described in the corresponding attribute
++    description entry)
++\f(CO-h\fP: Show help information about valid options
++.fi
++.PP
++.SH "DATE"
++$Date: 1999/03/10 19:55:15 $
++.PP
++.SH "VERSION"
++$Revision: 1.8 $
++.PP
++.SH "AUTHOR(S)"
++Johann Petrak using big portions of the original code by 
++J.R. Quinlan
+diff -Nu ../c45rel8/R8/Src/c4.5showrules.c ./c4.5showrules.c
+--- ../c45rel8/R8/Src/c4.5showrules.c	Thu Jan  1 01:00:00 1970
++++ ./c4.5showrules.c	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,328 @@
++/*************************************************************************/
++/*									 */
++/*  Generate labels for test cases using pre-generated rules     	 */
++/*  -----------------------------------------------------------------	 */
++/*									 */
++/*************************************************************************/
++
++/* the following comment follows the formatting conventions
++   of the OSE developmnet tools to allow automatic 
++   creation of man pages
++*/
++
++/*
++// [c45showrules]
++//
++// = FILENAME
++//   c45showrules.c
++//
++// = AUTHOR(S)
++//   Johann Petrak using big portions of the original code by 
++//   J.R. Quinlan
++//
++// = TITLE
++//   Show C4.5 rules and associated instances
++//
++// = DESCRIPTION
++//   This program can be used to print rules that were
++//   previously generated with the c4.5rules program and optionally
++//   include additional information like 
++//   node local instance numbers in the printout.
++//
++// = SYNOPSIS
++//   c4.5showrules  [-f\<fstem\>] [-c] [-u] [-M\<name\>] [-U] [-T\<n\>] [-h]
++//
++// = ARGUMENTS
++//   The program takes the following command-line arguments:
++// = BEGIN<NOFILL>
++//   <-f\<fstem\>>: Filestem of data/names file to use (as with c4.5)
++//   <-c>: Show instance indices (case numbers). This will
++//       generate an additional line starting with a hash symbol
++//       after each terminal node printed. This line will contain
++//       a blank seperated list of case numbers (counting from 0)
++//       that go into that node.
++//   <-u>: Use test data (fstem.test) instead of training data
++//       (fstem.data)
++//   <-M\<name\>>: Add the given name to the filestem for the 
++//       files containing the rules (fstem.rules)
++//       and the file that will contain the class labels
++//       (fstem.labs)  (default: empty)
++//   <-T\<n\>>: Specify target attribute number (counting from 1).
++//       If this paramter is not give, the classic C4.5
++//       scheme is used: the last attribute in the data file
++//       contains the class label and the names file contains
++//       the list of allowed class labels as its first entry.
++//       If this parameter is given, any discrete attribute 
++//       in the data file can be used as class attribute.
++//       The names file must contain an attribute description
++//       entry for all attribues, and must not contain the
++//       initial entry describing the class labels (the class
++//       labels are now described in the corresponding attribute
++//       description entry)
++//   <-h>: Show help information about valid options
++//   
++// = END<NOFILL>
++//
++// = VERSION
++//   $Revision: 1.9 $
++//
++// = DATE
++//   $Date: 1999/03/16 16:37:46 $
++//
++// = COPYRIGHT
++//   Copyright (1997) Austrian Research Institute
++//   for Artificial Intelligence, Vienna, Austria
++//
++//===============
++
++
++ */
++
++
++
++#include "defns.i"
++#include "types.i"
++
++static char * rcsid = "@(#)$Id: c4.5showrules.c,v 1.9 1999/03/16 16:37:46 johann Exp $";
++
++	/*  External data.  Note: uncommented variables have the same meaning
++	    as for decision trees  */
++
++Boolean         PRINTCASES = false;
++Boolean         USETEST = false;
++
++
++short		MaxAtt, MaxClass, MaxDiscrVal,
++                IGNOREMVCLASS = 0;
++
++ItemNo		MaxItem, TARGETCOLUMN = 0;
++
++Description	*Item;
++
++DiscrValue	*MaxAttVal;
++
++char		*SpecialStatus;
++
++String		*ClassName,
++                *ClassAttr,
++		*AttName,
++		**AttValName,
++                ModelSuffix = 0,
++		FileName = "DF";
++
++short		VERBOSITY = 0,
++		TRIALS;
++
++Boolean		TRACE	  = false;
++
++Boolean         PRINTTREE = true;
++
++Boolean		UNSEENS	  = false,
++		SIGTEST	  = false,	/* use significance test in rule pruning */
++		SIMANNEAL = false;	/* use simulated annealing */
++
++float		SIGTHRESH   = 0.05,
++		CF	    = 0.25,
++		REDUNDANCY  = 1.0;	/* factor that guesstimates the
++					   amount of redundancy and
++					   irrelevance in the attributes */
++
++PR		*Rule;			/* current rules */
++
++RuleNo		NRules = 0,		/* number of current rules */
++		*RuleIndex;		/* rule index */
++
++short		RuleSpace = 0;		/* space allocated for rules */
++
++ClassNo		DefaultClass;		/* current default class */
++
++RuleSet		*PRSet;			/* sets of rulesets */
++
++float		AttTestBits,		/* bits to encode tested att */
++		*BranchBits;		/* ditto attribute value */
++
++
++char suffixbuf[256];
++
++float	Confidence;		/* certainty factor of fired rule */
++				/* (set by BestRuleInd) */
++
++void MyPrintRule(RuleNo r);
++void MyPrintCondition(Condition c);
++
++
++
++RuleNo BestRuleInd(CaseDesc, Start)
++/*     ---------------  */
++    Description CaseDesc;
++    RuleNo Start;
++{
++    RuleNo r, ri;
++    float Strength();
++
++    ForEach(ri, Start, NRules)
++    {
++        Confidence = Strength(Rule[ri], CaseDesc);
++
++        if ( Confidence > 0.1 )
++        {
++            return ri;
++        }
++    }
++
++    Confidence = 0.0;
++    return 0;
++}
++
++/*************************************************************************/
++/*								  	 */
++/*		Print the current indexed ruleset		  	 */
++/*								  	 */
++/*************************************************************************/
++
++
++void MyPrintRules()
++{
++  short ri;
++  ItemNo i;
++
++  ForEach(ri, 1, NRules )
++    {
++      MyPrintRule(ri);
++    }
++  printf("\nDefault class: %s\n", ClassName[DefaultClass]);
++  if (PRINTCASES)
++  {
++    printf("# ");
++    ForEach(i, 0, MaxItem)
++      {
++	if  (0==BestRuleInd(Item[i], 1))
++	  printf("%d ",i);
++      }
++    printf("\n");
++  }
++}
++
++
++
++/*************************************************************************/
++/*								  	 */
++/*		Print the rule r				  	 */
++/*								  	 */
++/*************************************************************************/
++
++
++void MyPrintRule(r)
++  RuleNo r;
++{
++  ItemNo i;
++  short d;
++  RuleNo ri;
++
++  printf("\nRule %d:\n", r);
++  ForEach(d, 1, Rule[r].Size)
++    {
++      printf("    ");
++      PrintCondition(Rule[r].Lhs[d]);
++    }
++  printf("\t->  class %s  [%.1f%%]\n",
++	 ClassName[Rule[r].Rhs], 100 * (1 - Rule[r].Error)
++	 );
++  /* now print all case numbers covered by the preceding rule */
++  if (PRINTCASES)
++  {
++    printf("# ");
++    ForEach(i, 0, MaxItem)
++      {
++	if  (r==BestRuleInd(Item[i], 1))
++	  printf("%d ",i);
++      }
++    printf("\n");
++  }
++}
++
++
++int main(Argc, Argv)
++/*  ----  */
++  int Argc;
++char *Argv[];
++{
++  int o;
++  extern char *optarg;
++  extern int optind;
++  Boolean FirstTime=true;
++  int r;
++  
++  PrintHeader("Rule display");
++  
++  /*  Process options  */
++  
++  while ( (o = getopt(Argc, Argv, "f:cuT:M:h")) != EOF )
++  {
++    if ( FirstTime )
++    {
++      printf("\n    Options:\n");
++      FirstTime = false;
++    }
++    
++    switch (o)
++    {
++      case 'f':	FileName = optarg;
++      printf("\tFile stem <%s>\n", FileName);
++      break;
++      case 'M':   ModelSuffix = optarg;
++      printf("\tModel name <%s>\n", ModelSuffix);
++      break;
++      case 'c':   PRINTCASES = true;
++      printf("\toption -c: Print cases\n");
++      break;
++      case 'u':   USETEST = true;
++      printf("\toption -u: Use testset\n");
++      break; 
++      case 'T':   TARGETCOLUMN = atoi(optarg);
++      printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++      break;
++            case 'h':   printf("usage: %s [-c] [-u] -T<n> -M<name> -f<stem>\n",Argv[0]);
++			printf("  -c: Cases: show instance numbers\n");
++			printf("  -u: use test data instead of training data\n");
++			printf("  -f<xxxx>: specify file stem\n");
++			printf("  -T n: use attribute n (1..max) as target\n");
++			printf("  -M<name>: use <fstem><name>.tree/unpruned\n");
++			printf("  -h: show this help\n");
++                        exit(0);
++      case '?':	printf("unrecognised option\n");
++      exit(1);
++    }
++  } 
++  
++  printf("options processed!\n");
++  /*  Initialise  */
++  
++  GetNames();
++  printf("Names file read!\n");
++  
++  if (PRINTCASES)
++    if (USETEST)
++    {
++      printf("Reading test data!\n");
++      GetData(".test");
++      printf("\nRead %d cases (%d attributes) from %s.test\n",
++	     MaxItem+1, MaxAtt+1, FileName);
++    } else {
++      printf("Reading data!\n");
++      GetData(".data");
++      printf("\nRead %d cases (%d attributes) from %s.data\n",
++	     MaxItem+1, MaxAtt+1, FileName);
++    }
++  
++  GetRules();
++  printf("Rules file read!\n");
++  
++  
++  printf("Printing rules ...!\n");
++  MyPrintRules();
++  
++  
++  return(0);
++}
++
+diff -Nu ../c45rel8/R8/Src/c4.5showtree.1 ./c4.5showtree.1
+--- ../c45rel8/R8/Src/c4.5showtree.1	Thu Jan  1 01:00:00 1970
++++ ./c4.5showtree.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,74 @@
++.\" troff -man %
++.\"
++.\" DO NOT EDIT
++.\"
++.\" This manual page is automatically generated by class2man.
++.\"
++.ds sV Mar 16, 1999
++.ds sC c45showtree
++.ds sS 1
++.TH "\*(sC" "\*(sS" "\*(sV" "" ""
++.PP
++.SH "NAME"
++c45showtree \- 
++Show C4.5 trees and node-associated information and instances
++.SH "SYNOPSIS"
++.nf
++\f(CO
++c4.5showtree  [-f<fstem>]  [-v] [-w] [-c] [-u] [-M<name>] 
++              [-t<n>] [-U] [-T<n>] [-h]
++\fP
++.fi
++.PP
++.SH "DESCRIPTION"
++This program can be used to print a decision tree that was
++previously generated with the c4.5 program and optionally
++include additional information like node-local class distributions
++and node local instance numbers in the printout.
++.PP
++.SH "ARGUMENTS"
++The program takes the following command-line arguments:
++.nf
++\f(CO-f<fstem>\fP: Filestem of data/names file to use (as with c4.5)
++\f(CO-v<n>\fP: Verbosity level (default: 0)
++\f(CO-w\fP: Show instance weights with the instance indices.
++    The wights will be added after a seperating slash
++    to each index number.
++\f(CO-c\fP: Show instance indices (case numbers). This will
++    generate an additional line starting with a hash symbol
++    after each terminal node printed. This line will contain
++    a blank seperated list of case numbers (counting from 0)
++    that go into that node.
++\f(CO-u\fP: Use test data (fstem.test) instead of training data
++    (fstem.data)
++\f(CO-U\fP: Use unpruned tree (fstem.unpruned) instead of 
++    pruned one (fstem.tree)
++\f(CO-M<name>\fP: Add the given name to the filestem for the 
++    files containing the rules (fstem.rules)
++    and the file that will contain the class labels
++    (fstem.labs)  (default: empty)
++\f(CO-t<n>\fP: Use the tree from trial n (after windowing)
++\f(CO-T<n>\fP: Specify target attribute number (counting from 1).
++    If this paramter is not give, the classic C4.5
++    scheme is used: the last attribute in the data file
++    contains the class label and the names file contains
++    the list of allowed class labels as its first entry.
++    If this parameter is given, any discrete attribute 
++    in the data file can be used as class attribute.
++    The names file must contain an attribute description
++    entry for all attribues, and must not contain the
++    initial entry describing the class labels (the class
++    labels are now described in the corresponding attribute
++    description entry)
++\f(CO-h\fP: Show help information about valid options
++.fi
++.PP
++.SH "DATE"
++$Date: 1999/03/10 19:55:16 $
++.PP
++.SH "VERSION"
++$Revision: 1.7 $
++.PP
++.SH "AUTHOR(S)"
++Johann Petrak using big portions of the original code by 
++J.R. Quinlan
+diff -Nu ../c45rel8/R8/Src/c4.5showtree.c ./c4.5showtree.c
+--- ../c45rel8/R8/Src/c4.5showtree.c	Thu Jan  1 01:00:00 1970
++++ ./c4.5showtree.c	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,575 @@
++/*************************************************************************/
++   /*								   	
++    print a C4.5 decision tree
++    quick hack by JP from the original consult.c and trees.c programs
++    */
++/*								   	 */
++/*************************************************************************/
++
++/* the following comment follows the formatting conventions
++   of the OSE developmnet tools to allow automatic 
++   creation of man pages
++*/
++
++/*
++// [c45showtree]
++//
++// = FILENAME
++//   c4.5showtree.c
++//
++// = AUTHOR(S)
++//   Johann Petrak using big portions of the original code by 
++//   J.R. Quinlan
++//
++// = TITLE
++//   Show C4.5 trees and node-associated information and instances
++//
++// = DESCRIPTION
++//   This program can be used to print a decision tree that was
++//   previously generated with the c4.5 program and optionally
++//   include additional information like node-local class distributions
++//   and node local instance numbers in the printout.
++//
++// = SYNOPSIS
++//   c4.5showtree  [-f\<fstem\>]  [-v] [-w] [-c] [-u] [-M\<name\>] 
++//                 [-t\<n\>] [-U] [-T\<n\>] [-h]
++//
++// = ARGUMENTS
++//   The program takes the following command-line arguments:
++// = BEGIN<NOFILL>
++//   <-f\<fstem\>>: Filestem of data/names file to use (as with c4.5)
++//   <-v\<n\>>: Verbosity level (default: 0)
++//   <-w>: Show instance weights with the instance indices.
++//       The wights will be added after a seperating slash
++//       to each index number.
++//   <-c>: Show instance indices (case numbers). This will
++//       generate an additional line starting with a hash symbol
++//       after each terminal node printed. This line will contain
++//       a blank seperated list of case numbers (counting from 0)
++//       that go into that node.
++//   <-u>: Use test data (fstem.test) instead of training data
++//       (fstem.data)
++//   <-U>: Use unpruned tree (fstem.unpruned) instead of 
++//       pruned one (fstem.tree)
++//   <-M\<name\>>: Add the given name to the filestem for the 
++//       files containing the rules (fstem.rules)
++//       and the file that will contain the class labels
++//       (fstem.labs)  (default: empty)
++//   <-t\<n\>>: Use the tree from trial n (after windowing)
++//   <-T\<n\>>: Specify target attribute number (counting from 1).
++//       If this paramter is not give, the classic C4.5
++//       scheme is used: the last attribute in the data file
++//       contains the class label and the names file contains
++//       the list of allowed class labels as its first entry.
++//       If this parameter is given, any discrete attribute 
++//       in the data file can be used as class attribute.
++//       The names file must contain an attribute description
++//       entry for all attribues, and must not contain the
++//       initial entry describing the class labels (the class
++//       labels are now described in the corresponding attribute
++//       description entry)
++//   <-h>: Show help information about valid options
++//   
++// = END<NOFILL>
++//
++// = VERSION
++//   $Revision: 1.8 $
++//
++// = DATE
++//   $Date: 1999/03/16 16:37:47 $
++//
++// = COPYRIGHT
++//   Copyright (1997) Austrian Research Institute
++//   for Artificial Intelligence, Vienna, Austria
++//
++//===============
++
++
++ */
++
++
++#include<stdlib.h>
++#include<stdio.h>
++
++#include "defns.i"
++#include "types.i"
++#include "extern.i"
++
++static char * rcsid = "@(#)$Id: c4.5showtree.c,v 1.8 1999/03/16 16:37:47 johann Exp $";
++
++
++#define	Tab		"| "
++#define	TabSize		2
++#define	Width		8000	/* approx max width of printed trees */
++
++String format;
++ 
++short		MaxAtt, MaxClass, MaxDiscrVal,
++                IGNOREMVCLASS = 0;
++
++ItemNo		MaxItem, TARGETCOLUMN = 0;
++
++short           NumberTrial = 0;
++
++Description	*Item;
++
++DiscrValue	*MaxAttVal;
++
++String		*ClassName,
++                *ClassAttr,
++		*AttName,
++		**AttValName,
++                ModelSuffix = 0,
++		FileName = "DF";
++
++
++Boolean		UNPRUNED = false;
++Boolean		VERBOSE = false;
++Boolean		PRINTCASES = false;
++Boolean		PRINTWEIGHTS = false;
++Boolean         USETEST = false;
++
++char		*SpecialStatus;
++
++Boolean         PRINTTREE = true;
++
++typedef	struct ValRange *RangeDescRec;
++
++
++RangeDescRec RangeDesc;
++
++
++Tree	DecisionTree,			/* tree being used */
++	GetTree();
++
++char suffixbuf[256];
++
++void MyShowBranch(short Sh, Tree T, DiscrValue v);
++void MyIndent(short Sh, char * Mark);
++void MyShow(Tree T, short Sh);
++
++/*************************************************************************/
++/*  check if DT - node is reached for a case descritpion                 */
++/*  if no, return 0.0, otherwise return the case weight                  */
++/*************************************************************************/
++
++float getWeight(T,Node,CaseDesc,Weight,found)
++  Tree T;
++  Tree Node;
++  Description * CaseDesc;
++  float Weight;
++  Boolean * found;
++{
++    float weight;
++    DiscrValue v, dv;
++    float Cv;
++    Attribute a;
++
++  switch(T->NodeType)
++  {
++    case 0:
++    if (T==Node) 
++    {
++      *found = true;
++      return Weight;
++    } else {
++      *found = false;
++      return 0.0;
++    }
++    break;
++    case BrDiscr:
++    a = T->Tested;
++    v = DVal((*CaseDesc), a);
++    if ( v && v <= T->Forks )	/*  Make sure not new discrete value  */
++    {
++      return getWeight(T->Branch[v],Node,CaseDesc,Weight,found);
++    }
++    else
++    {
++      ForEach(v, 1, T->Forks)
++	{
++	  weight = getWeight(T->Branch[v], Node, CaseDesc, 
++			     (Weight * T->Branch[v]->Items) / T->Items,found);
++	  if (*found) return weight;
++	}
++    }
++    break;
++    case ThreshContin:  /* test of continuous attribute */
++    
++    a = T->Tested;
++    Cv = CVal((*CaseDesc), a);
++    
++    if ( Cv == Unknown )
++    {
++      ForEach(v, 1, 2)
++	{
++	  weight = getWeight(T->Branch[v], Node, CaseDesc,
++			     (Weight * T->Branch[v]->Items) / T->Items,found);
++	  if (*found) return weight;
++	}
++    }
++    else
++    {
++      v = ( Cv <= T->Cut ? 1 : 2 );
++      return getWeight(T->Branch[v], Node, CaseDesc, Weight, found);
++    }
++    break;
++
++    case BrSubset:  /* subset test on discrete attribute  */
++    
++    a = T->Tested;
++    dv = DVal((*CaseDesc), a);
++    
++    if ( dv )
++    {
++      ForEach(v, 1, T->Forks)
++	if ( In(dv, T->Subset[v]) )
++	  return  getWeight(T->Branch[v], Node, CaseDesc, Weight, found);
++    }
++
++    /*  Value unknown or not found in any of the subsets  */
++    
++    ForEach(v, 1, T->Forks)
++      {
++	weight = getWeight(T->Branch[v], Node, CaseDesc, 
++			   (Weight * T->Branch[v]->Items) / T->Items, found);
++	if (*found) return weight;
++      }
++    break;
++  }
++  *found = false;
++  return 0.0;
++}
++
++
++/*************************************************************************/
++/*									 */
++/*	Display entire decision tree T					 */
++/*									 */
++/*************************************************************************/
++
++
++void  MyPrintTree(T)
++/*  ----------  */
++Tree T;
++{
++  
++  printf("Decision Tree:\n");
++  
++  MyShow(T, 0);
++  printf("\n");
++  
++}
++
++
++/*************************************************************************/
++/*									 */
++/*	Display the tree T with offset Sh				 */
++/*									 */
++/*************************************************************************/
++
++
++void    MyShow(T, Sh)
++    Tree T;
++    short Sh;
++{
++
++    DiscrValue v, MaxV;
++    short MaxLine();
++
++    int i; 
++
++    float weight;
++    Boolean found;
++    
++    if ( T->NodeType )
++    {
++
++      MaxV = T->Forks;
++      
++      /*  Print simple cases first */
++      
++      ForEach(v, 1, MaxV)
++	{
++	  if ( ! T->Branch[v]->NodeType )
++	    {
++	      MyShowBranch(Sh, T, v);
++	    }
++	}
++	
++	/*  Print subtrees  */
++	
++	ForEach(v, 1, MaxV)
++	  {
++	    if ( T->Branch[v]->NodeType )
++	      {
++		MyShowBranch(Sh, T, v);
++	      }
++	  }
++    }
++    else
++      {
++	printf(" %s (%.1f", ClassName[T->Leaf], T->Items);
++	if ( T->Errors > 0 ) printf("/%.1f", T->Errors);
++	printf(")");
++	if (VERBOSE && T->Items > 0)
++	{
++	  printf("[%.1f",T->ClassDist[0]);
++	  for(i=1;i<MaxClass+1;i++)
++	    printf(",%.1f",T->ClassDist[i]);
++	  printf("]");
++	}
++	if (PRINTCASES)
++	{
++	  printf("\n#");
++	  for(i=0;i<=MaxItem;i++)
++	  {
++	    weight = getWeight(DecisionTree,T,&Item[i],1.0,&found);
++	    if (found)
++	    {
++	      printf(" %d",i);
++	      if (PRINTWEIGHTS) printf("/%.2f",weight);
++	    }
++	  }
++	}
++      }
++}
++
++
++/*************************************************************************/
++/*									 */
++/*	Print a node T with offset Sh, branch value v, and continue	 */
++/*									 */
++/*************************************************************************/
++
++
++void MyShowBranch(Sh, T, v)
++/*  -----------  */
++    short Sh;
++    Tree T;
++    DiscrValue v;
++{
++
++    DiscrValue Pv, Last;
++    Attribute Att;
++    Boolean FirstValue;
++    short TextWidth, Skip, Values=0, i;
++    
++    Att = T->Tested;
++
++    switch ( T->NodeType )
++    {
++	case BrDiscr:
++
++	    MyIndent(Sh, Tab);
++
++	if (VERBOSE)
++	{
++	  printf("[%.1f",T->ClassDist[0]);
++	  for(i=1;i<MaxClass+1;i++)
++	    printf(",%.1f",T->ClassDist[i]);
++	  printf("]");
++	}
++
++	    printf("%s = %s:", AttName[Att], AttValName[Att][v]);
++	    break;
++
++	case ThreshContin:
++
++	    MyIndent(Sh, Tab);
++
++	if (VERBOSE)
++	{
++	  printf("[%.1f",T->ClassDist[0]);
++	  for(i=1;i<MaxClass+1;i++)
++	    printf(",%.1f",T->ClassDist[i]);
++	  printf("]");
++	}
++
++	    printf("%s %s %g ",
++		    AttName[Att], ( v == 1 ? "<=" : ">" ), T->Cut);
++
++	    if ( T->Lower != T->Upper )
++	    {
++		printf("[%g,%g]", T->Lower, T->Upper);
++	    }
++
++	    printf(":");
++	    break;
++
++	case BrSubset:
++
++	    /*  Count values at this branch  */
++
++	    ForEach(Pv, 1, MaxAttVal[Att])
++	    {
++		if ( In(Pv, T->Subset[v]) )
++		{
++		    Last = Pv;
++		    Values++;
++		}
++	    }
++	    if ( ! Values ) return;
++
++	    MyIndent(Sh, Tab);
++
++	if (VERBOSE)
++	{
++	  printf("[%.1f",T->ClassDist[0]);
++	  for(i=1;i<MaxClass+1;i++)
++	    printf(",%.1f",T->ClassDist[i]);
++	  printf("]");
++	}
++
++	    if ( Values == 1 )
++	    {
++		printf("%s = %s:", AttName[Att], AttValName[Att][Last]);
++		break;
++	    }
++
++	    printf("%s in {", AttName[Att]);
++	    FirstValue = true;
++	    Skip = TextWidth = strlen(AttName[Att]) + 5;
++
++	    ForEach(Pv, 1, MaxAttVal[Att])
++	    {
++		if ( In(Pv, T->Subset[v]) )
++		{
++		    if ( ! FirstValue &&
++			 TextWidth + strlen(AttValName[Att][Pv]) + 11 > Width )
++		    {
++		  	MyIndent(Sh, Tab);
++			ForEach(i, 1, Skip) putchar(' ');
++
++			TextWidth = Skip;
++			FirstValue = true;
++		    }
++
++		    printf("%s%c", AttValName[Att][Pv], Pv == Last ? '}' : ',');
++		    TextWidth += strlen(AttValName[Att][Pv]) + 1;
++		    FirstValue = false;
++		}
++	    }
++	    putchar(':');
++    }
++
++    MyShow(T->Branch[v], Sh+1);
++}
++
++
++/*************************************************************************/
++/*								   	 */
++/*	Indent Sh columns					  	 */
++/*								  	 */
++/*************************************************************************/
++
++void MyIndent(Sh, Mark)
++/*  ------  */
++    short Sh;
++    char *Mark;
++{
++    printf("\n");
++    while ( Sh-- ) printf("%s", Mark);
++}
++
++
++/*************************************************************************/
++/*								  	 */
++/*  Main routine for printing the tree */
++/*								  	 */
++/*************************************************************************/
++
++
++int    main(Argc, Argv)
++/*  ---- 	 */
++    int Argc;
++    char *Argv[];
++{
++    int o,i;
++    extern char *optarg;
++
++    PrintHeader("Decision tree display");
++
++    /*  Process options  */
++
++    while ( (o = getopt(Argc, Argv, "hUvwcuf:t:T:M:")) != EOF )
++    {
++	switch (o)
++	{
++	    case 'v':	VERBOSE = true;
++	                printf("\toption -v: Verbose output\n");
++			break;
++	    case 'w':	PRINTWEIGHTS = true;
++	                printf("\toption -w: Print weights\n");
++			break;
++	    case 'c':	PRINTCASES = true;
++	                printf("\toption -c: Print cases\n");
++			break;
++	    case 'u':	USETEST = true;
++	                printf("\toption -u: Use testset\n");
++			break; 
++	    case 'f':	FileName = optarg;
++	  	        printf("\tFile stem <%s>\n", FileName);
++			break;
++	    case 'M':   ModelSuffix = optarg;
++		        printf("\tModel name <%s>\n", ModelSuffix);
++		        break;
++	    case 't':	NumberTrial = atoi(optarg);
++	                printf("\noption -t: Use tree from trial %d\n",
++			       NumberTrial);
++			break;
++	    case 'U':	UNPRUNED = true;
++	                printf("\toption -U: Use unpruned tree\n");
++			break;
++   	    case 'T':   TARGETCOLUMN = atoi(optarg);
++		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++		        break;
++            case 'h':   printf("usage: %s [-v] [-w] [-c] [-u] [-U] -t n -T n -M<name> -f stem\n",Argv[0]);
++			printf("  -v: Verbose - add class distribution info\n");
++			printf("  -w: show instance Weights\n");
++			printf("  -c: Cases: show instance numbers\n");
++			printf("  -u: use test data instead of training data\n");
++			printf("  -f xxxx: specify file stem\n");
++			printf("  -t n: use tree from trial n (default is first)\n");
++			printf("  -T n: use attribute n (1..max) as target\n");
++			printf("  -M<name>: use <fstem><name>.tree/unpruned\n");
++			printf("  -U: use Unpruned tree\n");
++                        exit(0);
++	    case '?':	printf("unrecognised option, usage: %s [-v] [-w] [-c] [-u] [-U] -t n -f stem\nor: %s -h",
++			       Argv[0],Argv[0]);
++			exit(1);
++	}
++    }
++
++    /*  Initialise  */
++
++    GetNames();
++
++    if (UNPRUNED)
++      for (i = 0; i<= NumberTrial; i++)
++	DecisionTree = GetTree(".unpruned");
++    else
++      DecisionTree = GetTree(".tree");
++
++    if(PRINTCASES)
++    {
++      if(USETEST)
++      {
++	GetData(".test");
++	printf("\nRead %d cases (%d attributes) from %s.test\n",
++	       MaxItem+1, MaxAtt+1, FileName);
++      } else {
++	GetData(".data");
++	printf("\nRead %d cases (%d attributes) from %s.data\n",
++	       MaxItem+1, MaxAtt+1, FileName);
++      }
++      /* add items to tree nodes */
++    }
++
++    MyPrintTree(DecisionTree);
++  
++    return 0;
++
++}
++
++
+diff -Nu ../c45rel8/R8/Src/classify.c ./classify.c
+--- ../c45rel8/R8/Src/classify.c	Fri Feb 28 23:52:09 2003
++++ ./classify.c	Fri Feb 28 23:52:09 2003
+@@ -12,6 +12,7 @@
+ 
+ float	*ClassSum=Nil;		/* ClassSum[c] = total weight of class c */
+ 
++static char * rcsid = "@(#)$Id: classify.c,v 1.4 1999/03/10 17:04:12 johann Exp $";
+ 
+ 
+ /*************************************************************************/
+diff -Nu ../c45rel8/R8/Src/confmat.c ./confmat.c
+--- ../c45rel8/R8/Src/confmat.c	Fri Feb 28 23:52:09 2003
++++ ./confmat.c	Fri Feb 28 23:52:09 2003
+@@ -9,6 +9,8 @@
+ #include "types.i"
+ #include "extern.i"
+ 
++static char * rcsid = "@(#)$Id: confmat.c,v 1.6 1999/03/10 17:04:13 johann Exp $";
++
+ 
+     PrintConfusionMatrix(ConfusionMat)
+ /*  --------------------  */
+@@ -16,8 +18,6 @@
+ {
+     short Row, Col;
+ 
+-    if ( MaxClass > 20 ) return;  /* Don't print nonsensical matrices */
+-
+     /*  Print the heading, then each row  */
+ 
+     printf("\n\n\t");
+@@ -44,7 +44,7 @@
+ 	    }
+ 	    else
+ 	    {
+-		printf("     ");
++		printf("    0");
+ 	    }
+ 	}
+ 	printf("\t(%c): class %s\n", 'a' + Row, ClassName[Row]);
+diff -Nu ../c45rel8/R8/Src/consult.1 ./consult.1
+--- ../c45rel8/R8/Src/consult.1	Thu Jan  1 01:00:00 1970
++++ ./consult.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,107 @@
++.EN
++.TH C4.5 1
++.SH NAME
++.PP
++consult \- classify items using a decision tree
++.SH SYNOPSIS
++.PP
++.B consult
++[ \fB-f\fR FNS ]
++[ \fB-t\fR ]
++.SH DESCRIPTION
++.PP
++.I Consult
++reads a decision tree produced by c4.5 and
++uses this to classify items whose description
++is provided by the user.
++The decision tree read is
++.I filestem.tree,
++where
++.I filestem
++is the file name stem (see manual entry for c4.5).
++.PP
++.I Consult
++prompts for the value of an attribute when needed.
++Unknown attribute values are specified as '?'.
++.PP
++If the attribute has discrete values, its value
++can be specified either as
++.ti 8
++.I v
++.br
++where v is one of the permissible values of the attribute, or as
++.ti 8
++.I "v1:p1, v2:p2, ... , vn:pn"
++.br
++where the vi's are some or all of the permissible values of the
++attribute and the pi's are corresponding probabilities.
++If the sum of the pi's is less than 1, the remaining probability
++is distributed equally among the unspecified values of the
++attribute.  For example, if attribute A has possible values
++X, Y and Z, the reply
++.ti 8
++X:0.5
++.br
++is the same as
++.ti 8
++X:0.5, Y:0.25, Z:0.25
++.PP
++If the attribute has real values, its value can be
++specified either as
++.ti 8
++.I r
++.br
++where r is a real number, or as
++.ti 8
++.I r1 - r2
++.br
++where r1 and r2 are real numbers.  The latter form is
++taken to mean "somewhere in the interval [r1,r2]".
++.PP
++To display the subtree of the decision tree with the
++current node at the root, '?t' may be entered in
++response to a request for an attribute value.
++.PP
++When all relevant attributes have been determined,
++consult will give one or more classes that the item
++might belong to.  The likelihood of a class may be
++indicated by a probability, followed sometimes by a
++probability interval.  For example,
++.ti 8
++.I "C1  CF = 0.9 [0.85 - 1]"
++.br
++means "class C1 with probability in the interval 0.85 - 1,
++and with best guess probability 0.9".
++.PP
++At the end of each item, consult will prompt for
++retrial of the same item, a new item, or end of session.
++When retrying an item, the previous values of queried
++attributes are displayed in square brackets.  If the
++value is unchanged, reply with a carriage return;
++otherwise, specify the changed value.
++.PP
++Options and their meanings are:
++.PP
++.TP 12
++.BI \-f filestem\^
++Specify the filename stem (default
++.B DF)
++.TP
++.B \-t
++Display the decision tree at the start of the consulting
++session.
++.SH FILES
++.PP
++.in 8
++consult
++.br
++filestem.names
++.br
++filestem.tree
++.in 0
++.PP
++.SH SEE ALSO
++.PP
++c4.5(1)
++.PP
++.SH BUGS
+diff -Nu ../c45rel8/R8/Src/consult.c ./consult.c
+--- ../c45rel8/R8/Src/consult.c	Fri Feb 28 23:52:09 2003
++++ ./consult.c	Fri Feb 28 23:52:09 2003
+@@ -9,34 +9,40 @@
+ #include "defns.i"
+ #include "types.i"
+ 
++static char * rcsid = "@(#)$Id: consult.c,v 1.8 1999/03/10 17:04:14 johann Exp $";
+ 
+ 		/*  External data  -- see c4.5.c for meanings  */
+ 
+ short		MaxAtt, MaxClass, MaxDiscrVal;
+ 
+-ItemNo		MaxItem;
++ItemNo		MaxItem,
++                TARGETCOLUMN = 0;
+ 
+ Description	*Item;
+ 
+ DiscrValue	*MaxAttVal;
+ 
+ String		*ClassName,
++                *ClassAttr,
+ 		*AttName,
+ 		**AttValName,
++                ModelSuffix = 0,
+ 		FileName = "DF";
+ 
+ char		*SpecialStatus;
+ 
+ short		VERBOSITY = 0,
++                IGNOREMVCLASS = 0, /* not used */
+ 		TRACE     = 0;
+ 
++Boolean         PRINTTREE = true;
+ 
+ 	/*  The interview module uses a more complex description of an
+ 	    case called a "Range Description".   The value of an
+ 	    attribute is given by
+ 	    - lower and upper bounds (continuous attribute)
+ 	    - probability of each possible value (discrete attribute)  */
+-
++ 
+ 
+ typedef	struct ValRange *RangeDescRec;
+ 
+@@ -59,7 +65,7 @@
+ 
+ #define Fuzz	0.01			/* minimum weight */
+ 
+-
++char suffixbuf[256];
+ 
+ /*************************************************************************/
+ /*								   	 */
+@@ -429,7 +435,7 @@
+ 
+     /*  Process options  */
+ 
+-    while ( (o = getopt(Argc, Argv, "tvf:")) != EOF )
++    while ( (o = getopt(Argc, Argv, "tvf:T:M:")) != EOF )
+     {
+ 	switch (o)
+ 	{
+@@ -439,6 +445,12 @@
+ 			break;
+ 	    case 'f':	FileName = optarg;
+ 			break;
++	    case 'M':   ModelSuffix = optarg;
++		        printf("\tModel name <%s>\n", ModelSuffix);
++		        break;
++   	    case 'T':   TARGETCOLUMN = atoi(optarg);
++		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++		        break;
+ 	    case '?':	printf("unrecognised option\n");
+ 			exit(1);
+ 	}
+diff -Nu ../c45rel8/R8/Src/consultr.1 ./consultr.1
+--- ../c45rel8/R8/Src/consultr.1	Thu Jan  1 01:00:00 1970
++++ ./consultr.1	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,100 @@
++.EN
++.TH C4.5 1
++.SH NAME
++.PP
++consultr \- classify items using a rule set
++.SH SYNOPSIS
++.PP
++.B consultr
++[ \fB-f\fR FNS ]
++[ \fB-t\fR ]
++.SH DESCRIPTION
++.PP
++.I Consultr
++reads a rule set produced by c4.5rules and
++uses this to classify items whose description
++is provided by the user.
++The rule set read is
++.I filestem.rules,
++where
++.I filestem
++is the file name stem (see manual entry for c4.5).
++.PP
++Consultr prompts for the value of an attribute when needed.
++Unknown attribute values are specified as '?'.
++.PP
++If the attribute has discrete values, its value
++can be specified either as
++.ti 8
++.I v
++.br
++where v is one of the permissible values of the attribute, or as
++.ti 8
++.I "v1:p1, v2:p2, ... , vn:pn"
++.br
++where the vi's are some or all of the permissible values of the
++attribute and the pi's are corresponding probabilities.
++If the sum of the pi's is less than 1, the remaining probability
++is distributed equally among the unspecified values of the
++attribute.  For example, if attribute A has possible values
++X, Y and Z, the reply
++.ti 8
++X:0.5
++.br
++is the same as
++.ti 8
++X:0.5, Y:0.25, Z:0.25
++.PP
++If the attribute has real values, its value can be
++specified either as
++.ti 8
++.I r
++.br
++where r is a real number, or as
++.ti 8
++.I r1 - r2
++.br
++where r1 and r2 are real numbers.  The latter form is
++taken to mean "somewhere in the interval [r1,r2]".
++.PP
++When all relevant attributes have been determined,
++consultr will give a class that the item might
++belong to.  The likelihood of the class may be
++indicated by a probability.  For example,
++.ti 8
++.I "C1  CF = 0.9"
++.br
++means "class C1 with probability 0.9".
++.PP
++At the end of each item, consultr will prompt for
++retrial of the same item, a new item, or end of session.
++When retrying an item, the previous values of queried
++attributes are displayed in square brackets.  If the
++value is unchanged, reply with a carriage return;
++otherwise, specify the changed value.
++.PP
++Options and their meanings are:
++.PP
++.TP 12
++.BI \-f filestem\^
++Specify the filename stem (default
++.B DF)
++.TP
++.B \-t
++Display the rule set at the start of the consulting
++session.
++.SH FILES
++.PP
++.in 8
++consultr
++.br
++filestem.names
++.br
++filestem.rules
++.in 0
++.PP
++.SH SEE ALSO
++.PP
++c4.5(1), c4.5rules(1)
++.PP
++.SH BUGS
+diff -Nu ../c45rel8/R8/Src/consultr.c ./consultr.c
+--- ../c45rel8/R8/Src/consultr.c	Fri Feb 28 23:52:09 2003
++++ ./consultr.c	Fri Feb 28 23:52:09 2003
+@@ -9,20 +9,25 @@
+ #include "defns.i"
+ #include "types.i"
+ 
++static char * rcsid = "@(#)$Id: consultr.c,v 1.8 1999/03/10 17:04:15 johann Exp $";
+ 
+ 		/*  External data  */
+ 
+-short		MaxAtt, MaxClass, MaxDiscrVal;
++short		MaxAtt, MaxClass, MaxDiscrVal,
++                IGNOREMVCLASS = 0; 
+ 
+-ItemNo		MaxItem;
++ItemNo		MaxItem,
++                TARGETCOLUMN = 0;
+ 
+ Description	*Item;
+ 
+ DiscrValue	*MaxAttVal;
+ 
+ String		*ClassName,
++                *ClassAttr,
+ 		*AttName,
+ 		**AttValName,
++                ModelSuffix = 0,
+ 		FileName = "DF";
+ 
+ char		*SpecialStatus;
+@@ -33,6 +38,8 @@
+ 
+ Boolean		FirstTime = true;
+ 
++Boolean         PRINTTREE = true;
++
+ PR		*Rule;
+ 
+ RuleNo		NRules = 0,
+@@ -61,6 +68,7 @@
+ 
+ #define	MINCF	0.50		/* minimum cf for useable rule */
+ 
++char suffixbuf[256];
+ 
+ /*************************************************************************/
+ /*								  	 */
+@@ -290,7 +298,7 @@
+ 
+     /*  Process options  */
+ 
+-    while ( (o = getopt(Argc, Argv, "tvf:")) != EOF )
++    while ( (o = getopt(Argc, Argv, "tvf:T:M:")) != EOF )
+     {
+ 	switch (o)
+ 	{
+@@ -300,6 +308,12 @@
+ 			break;
+ 	    case 'f':	FileName = optarg;
+ 			break;
++	    case 'M':   ModelSuffix = optarg;
++		        printf("\tModel name <%s>\n", ModelSuffix);
++		        break;
++   	    case 'T':   TARGETCOLUMN = atoi(optarg);
++		        printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
++		        break;
+ 	    case '?':	printf("unrecognised option\n");
+ 			exit(1);
+ 	}
+diff -Nu ../c45rel8/R8/Src/contin.c ./contin.c
+--- ../c45rel8/R8/Src/contin.c	Fri Feb 28 23:52:09 2003
++++ ./contin.c	Fri Feb 28 23:52:09 2003
+@@ -8,6 +8,7 @@
+ 
+ #include "buildex.i"
+ 
++static char * rcsid = "@(#)$Id: contin.c,v 1.4 1999/03/10 17:04:16 johann Exp $";
+ 
+ float
+ 	*SplitGain,	/* SplitGain[i] = gain with att value of item i as threshold */
+diff -Nu ../c45rel8/R8/Src/cvsstatus ./cvsstatus
+--- ../c45rel8/R8/Src/cvsstatus	Thu Jan  1 01:00:00 1970
++++ ./cvsstatus	Fri Feb 28 23:52:09 2003
+@@ -0,0 +1,743 @@
++? tmp.h
++? c4.5
++? g1.names
++? crx.x.tree
++? c4.5rules
++? golf.data
++? golf.hyp
++? golf.lsp
++? golf.names
++? golf.test
++? crx-C16.unpruned
++? consult
++? golf.names.new
++? golf.names.ne
++? patch
++? g1.data
++? g2.names
++? g2.data
++? crx-C16.tree
++? g4.names
++? crx.x.unpruned
++? g3.names
++? g3.data
++? crx.x.1.unpruned
++? bconsult
++? crx.names
++? consultr
++? bconsultr
++? crx.x.1.tree
++? c4.5showtree
++? g2.labs
++? g2.test
++? g4.data
++? crx-c20.unpruned
++? g4.labs
++? g4.test
++? TODO
++? g1.labs
++? g1.rules
++? crx-c20.tree
++? golf.m5
++? crx.data
++? crx.unpruned
++? crx.tree
++? crx.rules
++? crx-C16.rules
++? c1.data
++? c1.names
++? c1.unpruned
++? c1.tree
++? c1.test
++? crx.labs
++? c4.5showrules
++? golf.unpruned
++? golf.tree
++? golf.rules
++? golf.labs
++? c45-oefai.tar.gz
++? cvsstatus
++===================================================================
++File: CHANGES          	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/CHANGES,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: Makefile         	Status: Up-to-date
++
++   Working revision:	1.12
++   Repository revision:	1.12	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/Makefile,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++
++===================================================================
++File: Modifications    	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/Modifications,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: average.c        	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/average.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: bconsult.1       	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/bconsult.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: bconsult.c       	Status: Up-to-date
++
++   Working revision:	1.5
++   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/bconsult.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: bconsultr.c      	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/bconsultr.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: besttree.c       	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/besttree.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: build.c          	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/build.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: buildex.i        	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/buildex.i,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: c4.5.1           	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: c4.5.c           	Status: Up-to-date
++
++   Working revision:	1.6
++   Repository revision:	1.6	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: c4.5rules.1      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5rules.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: c4.5rules.c      	Status: Up-to-date
++
++   Working revision:	1.6
++   Repository revision:	1.6	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5rules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: c4.5showrules.c  	Status: Up-to-date
++
++   Working revision:	1.5
++   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5showrules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: c4.5showtree.c   	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/c4.5showtree.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: classify.c       	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/classify.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: confmat.c        	Status: Up-to-date
++
++   Working revision:	1.5
++   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/confmat.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.4)
++	v0-7                     	(revision: 1.2)
++	v0-6                     	(revision: 1.2)
++	v0-5                     	(revision: 1.2)
++
++===================================================================
++File: consult.1        	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consult.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: consult.c        	Status: Up-to-date
++
++   Working revision:	1.7
++   Repository revision:	1.7	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consult.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.4)
++	v0-7                     	(revision: 1.2)
++	v0-6                     	(revision: 1.2)
++	v0-5                     	(revision: 1.2)
++
++===================================================================
++File: consultr.1       	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consultr.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: consultr.c       	Status: Up-to-date
++
++   Working revision:	1.7
++   Repository revision:	1.7	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/consultr.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.4)
++	v0-7                     	(revision: 1.2)
++	v0-6                     	(revision: 1.2)
++	v0-5                     	(revision: 1.2)
++
++===================================================================
++File: contin.c         	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/contin.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: defns.i          	Status: Up-to-date
++
++   Working revision:	1.6
++   Repository revision:	1.6	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/defns.i,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.4)
++	v0-7                     	(revision: 1.2)
++	v0-6                     	(revision: 1.2)
++	v0-5                     	(revision: 1.2)
++
++===================================================================
++File: discr.c          	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/discr.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: extern.i         	Status: Up-to-date
++
++   Working revision:	1.5
++   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/extern.i,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: genlogs.c        	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/genlogs.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: genrules.c       	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/genrules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: getdata.c        	Status: Up-to-date
++
++   Working revision:	1.5
++   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/getdata.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: getnames.c       	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/getnames.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: getopt.c         	Status: Up-to-date
++
++   Working revision:	1.5
++   Repository revision:	1.5	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/getopt.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.4)
++	v0-7                     	(revision: 1.2)
++	v0-6                     	(revision: 1.2)
++	v0-5                     	(revision: 1.2)
++
++===================================================================
++File: header.c         	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/header.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: info.c           	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/info.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: makerules.c      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/makerules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: prune.c          	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/prune.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: prunerule.c      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/prunerule.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: rules.c          	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/rules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: rulex.i          	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/rulex.i,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: siftrules.c      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/siftrules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: sort.c           	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/sort.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: st-thresh.c      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/st-thresh.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: stats.c          	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/stats.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: subset.c         	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/subset.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: testrules.c      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/testrules.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: trees.c          	Status: Up-to-date
++
++   Working revision:	1.7
++   Repository revision:	1.7	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/trees.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.4)
++	v0-7                     	(revision: 1.2)
++	v0-6                     	(revision: 1.2)
++	v0-5                     	(revision: 1.2)
++
++===================================================================
++File: types.i          	Status: Up-to-date
++
++   Working revision:	1.4
++   Repository revision:	1.4	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/types.i,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: userint.c        	Status: Up-to-date
++
++   Working revision:	1.3
++   Repository revision:	1.3	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/userint.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.3)
++	v0-7                     	(revision: 1.1)
++	v0-6                     	(revision: 1.1)
++	v0-5                     	(revision: 1.1)
++
++===================================================================
++File: verbose.1        	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/verbose.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: verbrules.1      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/verbrules.1,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
++===================================================================
++File: xval-prep.c      	Status: Up-to-date
++
++   Working revision:	1.1
++   Repository revision:	1.1	/disk3/run/sr/cvsroot/projects/vie-kdd/C45/xval-prep.c,v
++   Sticky Tag:		(none)
++   Sticky Date:		(none)
++   Sticky Options:	(none)
++
++   Existing Tags:
++	Vorig-rel8               	(revision: 1.1)
++
+diff -Nu ../c45rel8/R8/Src/defns.i ./defns.i
+--- ../c45rel8/R8/Src/defns.i	Fri Feb 28 23:52:09 2003
++++ ./defns.i	Fri Feb 28 23:52:09 2003
+@@ -7,6 +7,7 @@
+ 
+ 
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <math.h>
+ 
+ #define	 Eof			EOF             /*char read on end of file*/
+@@ -16,14 +17,28 @@
+ #define	 None			-1
+ #define	 Epsilon                1E-3
+ 
+-long	 random();
++#ifdef UNIX
+ #define	 Random			((random()&2147483647) / 2147483648.0)
++#elif defined(DOS)
++/* :TODO: random doesnt exist at dos,we only have an int function rand that
++   returns a maximum value of 7fff
++   We probably should replace this with a decend random for both
++   UNIX and DOS.
++*/
++#define	Random                 ((rand()&32767) / 32768.0)
+ 
+-#define	 Max(a,b)               ((a)>(b) ? a : b) 
++/* :TODO: we dont have cfree in DOS */
++#define cfree free
++#elif defined(LINUX)
++#define cfree free
++#define	 Random			((random()&2147483647) / 2147483648.0)
++#endif
++
++#define  Max(a,b)               ((a)>(b) ? a : b) 
+ #define	 Min(a,b)               ((a)<(b) ? a : b) 
+ #define	 Round(x)		((int) (x+0.5))
+-#define	 Log2			0.69314718055994530942
+-#define	 Log(x)			((x) <= 0 ? 0.0 : log((float)x) / Log2)
++#define	 Log2			0.69314718055994530942L
++#define	 Log(x)			((x) <= 0 ? 0.0 : log((double)x) / Log2)
+ 
+ #define	 Bit(b)			(1 << (b))
+ #define	 In(b,s)		((s[(b) >> 3]) & Bit((b) & 07))
+diff -Nu ../c45rel8/R8/Src/discr.c ./discr.c
+--- ../c45rel8/R8/Src/discr.c	Fri Feb 28 23:52:09 2003
++++ ./discr.c	Fri Feb 28 23:52:09 2003
+@@ -8,6 +8,7 @@
+ 
+ #include "buildex.i"
+ 
++static char * rcsid = "@(#)$Id: discr.c,v 1.4 1999/03/10 17:04:18 johann Exp $";
+ 
+ /*************************************************************************/
+ /*									 */
+diff -Nu ../c45rel8/R8/Src/extern.i ./extern.i
+--- ../c45rel8/R8/Src/extern.i	Fri Feb 28 23:52:09 2003
++++ ./extern.i	Fri Feb 28 23:52:09 2003
+@@ -19,6 +19,7 @@
+ extern  char		*SpecialStatus;	/* special att treatment */
+ 
+ extern  String		*ClassName,	/* class names */
++			*ClassAttr,     /* Name of class atrribute */
+ 		  	*AttName,	/* att names */
+ 		  	**AttValName,	/* att value names */
+ 			FileName;	/* family name of files */
+@@ -43,10 +44,12 @@
+ 			SUBSET,		/* true if subset tests allowed */
+ 			BATCH,		/* true if windowing turned off */
+ 			UNSEENS,	/* true if to evaluate on test data */
+-			PROBTHRESH;	/* true if to use soft thresholds */
++			PROBTHRESH,	/* true if to use soft thresholds */
++	 		PRUNETREE;      /* true if trees should be pruned */
+ 
+ extern  ItemNo		MINOBJS,	/* minimum items each side of a cut */
+ 			WINDOW,		/* initial window size */
++			TARGETCOLUMN,   /* to be used instead of last col */
+ 			INCREMENT;	/* max window increment each iteration */
+ 
+ extern  float		CF;		/* confidence limit for tree pruning */
+diff -Nu ../c45rel8/R8/Src/genlogs.c ./genlogs.c
+--- ../c45rel8/R8/Src/genlogs.c	Fri Feb 28 23:52:09 2003
++++ ./genlogs.c	Fri Feb 28 23:52:09 2003
+@@ -10,6 +10,7 @@
+ #include "types.i"
+ #include "extern.i"
+ 
++static char * rcsid = "@(#)$Id: genlogs.c,v 1.4 1999/03/10 17:04:19 johann Exp $";
+ 
+ float	*LogItemNo;
+ double	*LogFact;
+diff -Nu ../c45rel8/R8/Src/genrules.c ./genrules.c
+--- ../c45rel8/R8/Src/genrules.c	Fri Feb 28 23:52:09 2003
++++ ./genrules.c	Fri Feb 28 23:52:09 2003
+@@ -10,6 +10,7 @@
+ #include "types.i"
+ #include "extern.i"
+ #include "rulex.i"
++static char * rcsid = "@(#)$Id: genrules.c,v 1.4 1999/03/10 17:04:20 johann Exp $";
+ 
+ 
+ /*************************************************************************/
+diff -Nu ../c45rel8/R8/Src/getdata.c ./getdata.c
+--- ../c45rel8/R8/Src/getdata.c	Fri Feb 28 23:52:09 2003
++++ ./getdata.c	Sat Mar 15 10:34:25 2003
+@@ -10,9 +10,12 @@
+ #include "types.i"
+ #include "extern.i"
+ 
+-#define Inc 2048
++static char * rcsid = "@(#)$Id: getdata.c,v 1.6 1999/03/10 17:04:21 johann Exp $";
+ 
++#define Inc 2048
+ 
++short extern IGNOREMVCLASS;
++unsigned int NrMVClass;
+ 
+ /*************************************************************************/
+ /*									 */
+@@ -89,19 +92,54 @@
+     FILE *Df;
+ {
+     Attribute Att;
++    Attribute Col, TmpCol;
++    Attribute targetcol = TARGETCOLUMN-1;
+     char name[500], *endname, *CopyString();
+     Boolean ReadName();
+     int Dv;
++    int ret;
+     float Cv;
+     Description Dvec;
+     double strtod();
+-
+     if ( ReadName(Df, name) )
+     {
+ 	Dvec = (Description) calloc(MaxAtt+2, sizeof(AttValue));
+ 
+-        ForEach(Att, 0, MaxAtt)
++    again:
++	Att = -1;
++        ForEach(Col, 0, (TARGETCOLUMN==0 ? MaxAtt : (MaxAtt+1)))
+         {
++	  /* if we are at column == TARGETCOLUMN, 
++	     lets put the data into the class column instead */
++	  if ((TARGETCOLUMN!=0) && (Col == targetcol)) {
++	    if ( (Dv = Which(name, ClassName, 0, MaxClass)) < 0 )
++	    {
++	      if (strcmp(name,"?") == 0) {
++		if (IGNOREMVCLASS==1) {
++		  NrMVClass++;
++		  ForEach(TmpCol, Col, (MaxAtt+1)) 
++		    if (!ReadName(Df, name) )
++		      return Nil;
++		  goto again;
++		} else if (IGNOREMVCLASS == 2) {
++		  NrMVClass++;
++		  Dv = 0;
++		} else {
++		  Error(6, "", name);
++		  NrMVClass++;
++		  Dv=0;
++		}
++	      } else {
++		Error(5, "", name);
++		NrMVClass++;
++		Dv = 0;
++	      }
++	    }
++	    Class(Dvec) = Dv;
++	    if (Col<=MaxAtt) ReadName(Df, name);
++	  } else { 
++	    
++	    Att++; 
+ 	    if ( SpecialStatus[Att] == IGNORE )
+ 	    {
+ 		/*  Skip this value  */
+@@ -161,16 +199,40 @@
+ 		CVal(Dvec, Att) = Cv;
+ 	    }
+ 
+-	    ReadName(Df, name);
++	    if (TARGETCOLUMN==0)
++	      ReadName(Df, name);
++	    else if (Col<=MaxAtt)
++	      ReadName(Df, name);
+         }
+-
+-        if ( (Dv = Which(name, ClassName, 0, MaxClass)) < 0 )
+-        {
+-	    Error(5, "", name);
+-	    Dv = 0;
+-        }
+-	Class(Dvec) = Dv;
+-
++	} /* end of old code */
++	
++	if (TARGETCOLUMN==0) {
++	  
++	  if ( (Dv = Which(name, ClassName, 0, MaxClass)) < 0 )
++	  {
++	    if (strcmp(name,"?") == 0) {
++	      if (IGNOREMVCLASS==1) {
++		NrMVClass++;
++		ForEach(TmpCol, Col, (MaxAtt+1))
++		  if (!ReadName(Df, name) )
++		    return Nil;
++		goto again;
++	      } else if (IGNOREMVCLASS == 2) {
++		NrMVClass++;
++		Dv = 0;
++	      } else {
++		Error(5, "", name);
++		NrMVClass++;
++		Dv = 0;
++	      }}
++	    else {
++	      Error(5, "", name);
++	      NrMVClass++;
++	      Dv = 0;
++	    }
++	  }
++	  Class(Dvec) = Dv;
++	}
+ 	return Dvec;
+     }
+     else
+diff -Nu ../c45rel8/R8/Src/getnames.c ./getnames.c
+--- ../c45rel8/R8/Src/getnames.c	Fri Feb 28 23:52:09 2003
++++ ./getnames.c	Fri Feb 28 23:52:09 2003
+@@ -13,6 +13,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ 
++static char * rcsid = "@(#)$Id: getnames.c,v 1.5 1999/03/10 17:04:22 johann Exp $";
+ 
+ #define  Space(s)	(s == ' ' || s == '\n' || s == '\t')
+ #define  SkipComment	while ( ( c = getc(f) ) != '\n' )
+@@ -126,7 +127,10 @@
+ {
+     FILE *Nf, *fopen();
+     char Fn[100], Buffer[1000];
++    int targetcol = TARGETCOLUMN-1; /* zero based insted of 1-based */
++    char * tmpstrp;
+     DiscrValue v;
++    int Col;
+     int AttCeiling=100, ClassCeiling=100, ValCeiling;
+ 
+     /*  Open names file  */
+@@ -137,22 +141,37 @@
+ 
+     /*  Get class names from names file  */
+ 
++
+     ClassName = (String *) calloc(ClassCeiling, sizeof(String));
+     MaxClass = -1;
+-    do
+-    {
++    
++    /* If we specify the column number of the target value
++       as a parameter, this won't exist in the names file
++       and has to be skipped.
++    */
++
++    if (TARGETCOLUMN == 0) {
++      
++      do
++      {
+ 	ReadName(Nf, Buffer);
+-
++	
+ 	if ( ++MaxClass >= ClassCeiling)
+ 	{
+-	    ClassCeiling += 100;
+-	    ClassName = (String *) realloc(ClassName, ClassCeiling*sizeof(String));
++	  ClassCeiling += 100;
++	  ClassName = (String *) realloc(ClassName, ClassCeiling*sizeof(String));
+ 	}
+ 	ClassName[MaxClass] = CopyString(Buffer);
++      }
++      while ( Delimiter == ',' );
++      
+     }
+-    while ( Delimiter == ',' );
+-
+     /*  Get attribute and attribute value names from names file  */
++    
++    /* if the target Attribute is given as a paramter, we do the following:
++       after reading all attribute descriptions, swap the info for
++       the last and the specified attribute (if different)
++    */
+ 
+     AttName = (String *) calloc(AttCeiling, sizeof(String));
+     MaxAttVal = (DiscrValue *) calloc(AttCeiling, sizeof(DiscrValue));
+@@ -160,10 +179,35 @@
+     SpecialStatus = (char *) malloc(AttCeiling);
+ 
+     MaxAtt = -1;
++    Col = 0;
+     while ( ReadName(Nf, Buffer) )
+     {
+ 	if ( Delimiter != ':' ) Error(1, Buffer, "");
+ 
++	/* if we are processing the target attribute, put info
++	   into class names instead of setting up an attribute;
++	   also remember the name of the class attribute
++	*/
++	if (targetcol == Col++) {
++	  
++	  ClassAttr = CopyString(Buffer); 
++	  do
++	  {
++	    if ( ! ( ReadName(Nf, Buffer) ) ) Error(2, "target values", "");
++	    
++	    if ( ++MaxClass >= ClassCeiling)
++	    {
++	      ClassCeiling += 100;
++	      ClassName = (String *) realloc(ClassName, ClassCeiling*sizeof(String));
++	    }
++	    ClassName[MaxClass] = CopyString(Buffer);
++	  }
++	  while ( Delimiter == ',' );
++
++	} else 
++
++	{ /* begin old code */
++
+ 	if ( ++MaxAtt >= AttCeiling )
+ 	{
+ 	    AttCeiling += 100;
+@@ -236,9 +280,12 @@
+ 	}
+ 	else
+ 	if ( MaxAttVal[MaxAtt] > MaxDiscrVal ) MaxDiscrVal = MaxAttVal[MaxAtt];
++	} /* end old code */
+     }
+ 
+     fclose(Nf);
++
++
+ }
+ 
+ 
+@@ -316,6 +363,7 @@
+ 		break;
+ 
+ 	case 5: printf("case %d's class of '%s' is illegal\n", MaxItem+1, s2);
++	case 6: printf("case %d: missing value '%s' not allowed\n", MaxItem+1, s2);
+     }
+ 
+     if ( ++Messages > 10 )
+diff -Nu ../c45rel8/R8/Src/getopt.c ./getopt.c
+--- ../c45rel8/R8/Src/getopt.c	Fri Feb 28 23:52:09 2003
++++ ./getopt.c	Fri Feb 28 23:52:09 2003
+@@ -10,7 +10,7 @@
+ 
+ 
+ #include <stdio.h>
+-
++static char * rcsid = "@(#)$Id: getopt.c,v 1.6 1999/03/10 17:04:23 johann Exp $";
+ 
+ int optind = 1;
+ char *optarg;
+@@ -19,7 +19,8 @@
+     getopt(Argc, Argv, Str)
+ /*  ------  */
+     int Argc;
+-    char **Argv, *Str;
++    char * const *Argv;
++    const char *Str;
+ {
+     int Optchar;
+     char *Option;
+diff -Nu ../c45rel8/R8/Src/header.c ./header.c
+--- ../c45rel8/R8/Src/header.c	Fri Feb 28 23:52:09 2003
++++ ./header.c	Fri Feb 28 23:52:09 2003
+@@ -5,6 +5,7 @@
+ /*									 */
+ /*************************************************************************/
+ 
++static char * rcsid = "@(#)$Id: header.c,v 1.4 1999/03/10 17:04:25 johann Exp $";
+ 
+ #define  RELEASE "8"
+ 
+diff -Nu ../c45rel8/R8/Src/info.c ./info.c
+--- ../c45rel8/R8/Src/info.c	Fri Feb 28 23:52:09 2003
++++ ./info.c	Fri Feb 28 23:52:09 2003
+@@ -8,6 +8,7 @@
+ 
+ #include "buildex.i"
+ 
++static char * rcsid = "@(#)$Id: info.c,v 1.4 1999/03/10 17:04:26 johann Exp $";
+ 
+ /*************************************************************************/
+ /*									 */
+@@ -45,7 +46,7 @@
+     }
+     else
+     {
+-	return ( ThisInfo > 0 && ThisGain > -Epsilon ? ThisGain : -Epsilon );
++	return ThisInfo > 0 && ThisGain > 0 ? ThisGain : - Epsilon;
+     }
+ }
+ 
+@@ -145,7 +146,7 @@
+ /*  Compute the total information in V[ MinVal..MaxVal ]		 */
+ /*									 */
+ /*************************************************************************/
+-
++ 
+ 
+ float TotalInfo(V, MinVal, MaxVal)
+ /*    ---------  */
+@@ -153,18 +154,25 @@
+     DiscrValue MinVal, MaxVal;
+ {
+     DiscrValue v;
+-    float Sum=0.0;
++    double Sum=0.0;
+     ItemCount N, TotalItems=0;
+ 
+     ForEach(v, MinVal, MaxVal)
+     {
+ 	N = V[v];
+-
+-	Sum += N * Log(N);
++	/* JP: originally there was just a line:
++	   Sum += N * Log(N);
++           With gcc 2.95.1 and optimization on, this produced 
++	   wrong results (NaN). Strangely, when Log(N) is
++	   *looked at* before it is used for the Sum, it would work!
++	   Looks like a compiler bug to me
++	*/
++	if (Log(N) > 9999999.999) { printf(""); }
++	Sum += (double)N * Log(N);
+ 	TotalItems += N;
+     }
+-
+-    return TotalItems * Log(TotalItems) - Sum;
++ 
++    return (double)TotalItems * Log(TotalItems) - (double)Sum;
+ }
+ 
+ 
+diff -Nu ../c45rel8/R8/Src/makerules.c ./makerules.c
+--- ../c45rel8/R8/Src/makerules.c	Fri Feb 28 23:52:09 2003
++++ ./makerules.c	Fri Feb 28 23:52:09 2003
+@@ -11,6 +11,7 @@
+ #include "extern.i"
+ #include "rulex.i"
+ 
++static char * rcsid = "@(#)$Id: makerules.c,v 1.2 1999/03/10 17:04:27 johann Exp $";
+ 
+ ItemNo	*TargetClassFreq,	/* [Boolean] */
+ 	*Errors,		/* [Condition] */
+@@ -179,7 +180,7 @@
+ 	}
+     }
+     else
+-    if ( t->Items >= 1 )
++    if ( t->Items > 1 )
+     {
+ 	/*  Leaf of decision tree - construct the set of
+  	    conditions associated with this leaf and prune  */
diff -Nu ../c45rel8/R8/Src/prune.c ./prune.c
--- ../c45rel8/R8/Src/prune.c	Fri Feb 28 23:52:09 2003
+++ ./prune.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: prune.c,v 1.5 1999/03/10 17:04:28 johann Exp $";
 
 extern	ItemCount	*Weight;
 
@@ -40,6 +41,9 @@
     AllKnown = true;
 
     Verbosity(1) printf("\n");
+
+    /* Does this quick hack work? JP */
+    if (!PRUNETREE) return true;
 
     Changed = false;
 
diff -Nu ../c45rel8/R8/Src/prunerule.c ./prunerule.c
--- ../c45rel8/R8/Src/prunerule.c	Fri Feb 28 23:52:09 2003
+++ ./prunerule.c	Fri Feb 28 23:52:09 2003
@@ -11,6 +11,7 @@
 #include "extern.i"
 #include "rulex.i"
 
+static char * rcsid = "@(#)$Id: prunerule.c,v 1.2 1999/03/10 17:04:29 johann Exp $";
 
 /*  External data structures used in building rules  */
 
@@ -390,7 +391,8 @@
 /*************************************************************************/
 /*									 */
 /*  Determine whether the given case description satisfies the given	 */
-/*  condition.								 */
+/*  condition. To save time, the outcome of every test on every item	 */
+/*  is set the first time it is needed and retained for later use	 */
 /*									 */
 /*************************************************************************/
 
diff -Nu ../c45rel8/R8/Src/rules.c ./rules.c
--- ../c45rel8/R8/Src/rules.c	Fri Feb 28 23:52:09 2003
+++ ./rules.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 #include "rulex.i"
+static char * rcsid = "@(#)$Id: rules.c,v 1.5 1999/03/10 17:04:31 johann Exp $";
 
 extern  FILE	*TRf;		/* rules file */
 
@@ -20,6 +21,10 @@
 FILE	*fopen();
 extern char	Fn[500];	/* file name */
 
+extern String ModelSuffix;
+
+char suffixbuf[256];
+
 
 /*************************************************************************/
 /*								  	 */
@@ -38,7 +43,12 @@
     if ( TRf ) fclose(TRf);
 
     strcpy(Fn, FileName);
-    strcat(Fn, ".rules");
+    if (ModelSuffix == 0)
+      sprintf(suffixbuf,".rules");
+    else
+      sprintf(suffixbuf,"%s.rules",ModelSuffix);
+	
+    strcat(Fn, suffixbuf);
     if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
     
     StreamOut((char *) &NRules, sizeof(RuleNo));
@@ -96,7 +106,13 @@
     if ( TRf ) fclose(TRf);
 
     strcpy(Fn, FileName);
-    strcat(Fn, ".rules");
+    strcpy(Fn, FileName);
+    if (ModelSuffix == 0)
+      sprintf(suffixbuf,".rules");
+    else
+      sprintf(suffixbuf,"%s.rules",ModelSuffix);
+	
+    strcat(Fn, suffixbuf);
     if ( ! ( TRf = fopen(Fn, "r") ) ) Error(0, Fn, "");
     
     StreamIn((char *) &nr, sizeof(RuleNo));
diff -Nu ../c45rel8/R8/Src/siftrules.c ./siftrules.c
--- ../c45rel8/R8/Src/siftrules.c	Fri Feb 28 23:52:09 2003
+++ ./siftrules.c	Fri Feb 28 23:52:09 2003
@@ -11,6 +11,7 @@
 #include "extern.i"
 #include "rulex.i"
 
+static char * rcsid = "@(#)$Id: siftrules.c,v 1.2 1999/03/10 17:04:32 johann Exp $";
 
 ItemNo	*ClassFreq,	/* ClassFreq[c]	= no. items of class c  */
 	*Covered,	/* Covered[i]	= no. included rules that cover item i */
@@ -141,7 +142,7 @@
 
 	ForEach(r, 1, NRules)
 	{
-	    Match[r][i] = Strength(Rule[r], Item[i]) > 0.1;
+	    Match[r][i] = Strength(Rule[r], Item[i]) > 0.3;
 
 	    if ( Match[r][i] )
 	    {
diff -Nu ../c45rel8/R8/Src/sort.c ./sort.c
--- ../c45rel8/R8/Src/sort.c	Fri Feb 28 23:52:09 2003
+++ ./sort.c	Fri Feb 28 23:52:09 2003
@@ -11,6 +11,7 @@
 #include "extern.i"
 
 
+static char * rcsid = "@(#)$Id: sort.c,v 1.4 1999/03/10 17:04:33 johann Exp $";
 
 /*************************************************************************/
 /*									 */
diff -Nu ../c45rel8/R8/Src/st-thresh.c ./st-thresh.c
--- ../c45rel8/R8/Src/st-thresh.c	Fri Feb 28 23:52:09 2003
+++ ./st-thresh.c	Fri Feb 28 23:52:09 2003
@@ -9,6 +9,7 @@
 #include "defns.i"
 #include "types.i"
 #include "extern.i"
+static char * rcsid = "@(#)$Id: st-thresh.c,v 1.2 1999/03/10 17:04:34 johann Exp $";
 
 
 Boolean *LHSErr,	/*  Does a misclassification occur with this value of an att  */
diff -Nu ../c45rel8/R8/Src/stats.c ./stats.c
--- ../c45rel8/R8/Src/stats.c	Fri Feb 28 23:52:09 2003
+++ ./stats.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: stats.c,v 1.4 1999/03/10 17:04:36 johann Exp $";
 									
 /*************************************************************************/
 /*									 */
diff -Nu ../c45rel8/R8/Src/subset.c ./subset.c
--- ../c45rel8/R8/Src/subset.c	Fri Feb 28 23:52:09 2003
+++ ./subset.c	Fri Feb 28 23:52:09 2003
@@ -8,6 +8,7 @@
 
 #include "buildex.i"
 
+static char * rcsid = "@(#)$Id: subset.c,v 1.4 1999/03/10 17:04:37 johann Exp $";
 
 ItemCount
 	*Slice1,	/* Slice1[c]    = saved values of Freq[x][c] in subset.c */
diff -Nu ../c45rel8/R8/Src/testrules.c ./testrules.c
--- ../c45rel8/R8/Src/testrules.c	Fri Feb 28 23:52:09 2003
+++ ./testrules.c	Fri Feb 28 23:52:09 2003
@@ -11,6 +11,7 @@
 #include "extern.i"
 #include "rulex.i"
 
+static char * rcsid = "@(#)$Id: testrules.c,v 1.2 1999/03/10 17:04:38 johann Exp $";
 
 
 /*************************************************************************/
diff -Nu ../c45rel8/R8/Src/tmp.h ./tmp.h
--- ../c45rel8/R8/Src/tmp.h	Thu Jan  1 01:00:00 1970
+++ ./tmp.h	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,264 @@
+ /*************************************************************************/
+/*									 */
+/*	bconsult          						 */
+/*	------------------						 */
+/*									 */
+/*************************************************************************/
+
+/* the following comment follows the formatting conventions
+   of the OSE developmnet tools to allow automatic 
+   creation of man pages
+*/
+
+/*
+//== FILE HEADER BEGIN
+//
+// = FILENAME
+//   bconsult.c
+//
+// = AUTHOR(S)
+//   Johann Petrak 
+//
+// = DESCRIPTION
+//   This program allows the creation of a file containing class
+//   labels from a .data or a .test file and .tree file previously
+//   generated with the c4.5 program.
+//
+// = SYNOPSIS
+//   bconsult [-ffstem] [-Mname] [-u] [-l] [-vn] [-t] [-Tn] [-In]
+//
+// = ARGUMENTS
+//   The program takes the following command-line arguments:
+// = BEGIN<NOFILL>
+//   -f filestem filestem of data/names file to use
+//   -r          randomize data rows before splitting 
+// = END<NOFILL>
+//
+// = VERSION
+//   $Revision: 1.8 $
+//
+// = DATE
+//   $Date: 1997/12/07 17:24:35 $
+//
+// = COPYRIGHT
+//   Copyright (1997) Austrian Research Institute
+//   for Artificial Intelligence, Vienna, Austria
+//
+//===============
+
+
+ */
+
+
+#include "defns.i"
+#include "types.i"
+
+
+    /*  External data, described in extern.i  */
+
+unsigned int NrMVClass = 0;
+
+short		MaxAtt, MaxClass, MaxDiscrVal = 2;
+
+ItemNo		MaxItem;
+
+Description	*Item;
+
+DiscrValue	*MaxAttVal;
+
+char		*SpecialStatus;
+
+String		*ClassName,
+                *ClassAttr,
+		*AttName,
+		**AttValName,
+                ModelSuffix = 0,
+		FileName = "DF";
+
+short		VERBOSITY = 0,
+                IGNOREMVCLASS = 0,
+		TRIALS    = 10;
+
+Boolean         PRINTTREE = true,
+                PRUNETREE  = true;
+
+Boolean		GAINRATIO  = true,
+		SUBSET     = false,
+		BATCH      = true,
+		UNSEENS    = false,
+		PROBTHRESH = false,
+	        TRACE      = false,
+                TRAIN      = false,
+	        UNPRUNED   = false;
+
+ItemNo		MINOBJS   = 2,
+		TARGETCOLUMN = 0,
+		WINDOW    = 0,
+		INCREMENT = 0;
+
+float		CF = 0.25;
+
+Tree		*Pruned;
+
+Tree   DecisionTree,			/* tree being used */
+       GetTree();
+
+Boolean		AllKnown = true;
+
+char suffixbuf[256];
+
+WriteLabs(Extension)
+  String Extension;
+{
+  char Fn[500];
+  FILE *TRf = 0;
+  
+  ClassNo RealClass, PrunedClass, Category();
+  short t;
+  ItemNo *ConfusionMat, i, PrunedErrors;
+  
+  strcpy(Fn, FileName);
+  strcat(Fn, Extension);
+  if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
+
+  ConfusionMat = (ItemNo *) calloc((MaxClass+1)*(MaxClass+1), sizeof(ItemNo));
+  
+  printf("\n");
+  
+  PrunedErrors = 0;
+
+  ForEach(i, 0, MaxItem)
+    {
+      RealClass = Class(Item[i]);
+      PrunedClass = Category(Item[i], DecisionTree);
+      
+      fprintf(TRf,"%s\n",ClassName[PrunedClass]);
+
+      if ( PrunedClass != RealClass ) PrunedErrors++;
+      ConfusionMat[RealClass*(MaxClass+1)+PrunedClass]++;
+    }
+      
+  fclose(TRf);
+
+  printf("\t%4d  %3d(%4.1f%%)\n",
+	 TreeSize(DecisionTree), PrunedErrors,
+	 100.0*PrunedErrors / (MaxItem+1.0));
+
+  
+  
+  PrintConfusionMatrix(ConfusionMat);
+  free(ConfusionMat);
+}
+
+
+    main(Argc, Argv)
+/*  ----  */
+    int Argc;
+    char *Argv[];
+{
+    int o;
+    extern char *optarg;
+    extern int optind;
+    Boolean FirstTime=true;
+    short Best, BestTree();
+
+    PrintHeader("(OFAI) labels from tree generator");
+
+    /*  Process options  */
+
+    while ( (o = getopt(Argc, Argv, "f:v:tuT:lI:M:h")) != EOF )
+    {
+	if ( FirstTime && o != 'h')
+	{
+	    printf("\n    Options:\n");
+	    FirstTime = false;
+	}
+
+	switch (o)
+	{
+	case 'f':   FileName = optarg;
+		    printf("\tFile stem <%s>\n", FileName);
+		    break;
+	case 'M':   ModelSuffix = optarg;
+		    printf("\tModel name <%s>\n", ModelSuffix);
+		    break;
+	case 'v':   VERBOSITY = atoi(optarg);
+		    printf("\tVerbosity level %d\n", VERBOSITY);
+		    break;
+	case 't':   TRACE = true;
+		    printf("\tPrint tree\n", VERBOSITY);
+		    break;
+	case 'u':   UNPRUNED = true;
+		    printf("\tUse unpruned tree\n", VERBOSITY);
+		    break;
+	case 'l':   TRAIN = true;
+		    printf("\tUse training (learning) set\n", VERBOSITY);
+		    break;
+	case 'T':   TARGETCOLUMN = atoi(optarg);
+	            printf("\tTarget attribute in column %d\n", TARGETCOLUMN);
+		    break;
+	case 'I':   IGNOREMVCLASS = atoi(optarg);
+	            if (IGNOREMVCLASS == 0)
+		      printf("\tStandard handling of MVs as class values\n");
+		    else if  (IGNOREMVCLASS == 1)
+		      printf("\tIgnore cases with MV as class value\n");
+		    else if  (IGNOREMVCLASS == 2)
+		      printf("\tSubstitute first class label instead of MVs\n");
+		    else {
+		      printf("%s not a valid argument for option -I\n",optarg);
+		      exit(1);
+		    }
+		    break;
+	  case 'h': printf("usage: %s [options]\n", Argv[0]);
+	            printf("  options: [-f<fstem>] [-M<name>] [-u] [-l] [-v<n>] [-t] [-T<n>] [-I<n>]\n");
+		    printf("  -f<fstem>: filestem (DF)\n");
+		    printf("  -M<name>:  create <fstem><name>.tree/.unpruned ('')\n");
+		    printf("  -u:        use unpruned tree (use pruned)\n");
+		    printf("  -l:        use training set (test set)\n");
+		    printf("  -v<n>:     verbosity level (0)\n");
+		    printf("  -t:        print tree (dont print tree)\n");
+		    printf("  -T<n>:     target is attribute n, use changed namesfile (last attr)\n");
+		    printf("  -I<n>:     n=1: ignore records w/ MV in class\n");
+		    printf("             n=2: substitute first class label  (treat as error)\n");
+		    printf("  -h:        show this help info\n");
+		    printf("\n\n  The program will create a file <fstem>.labs that contains\n  the assigned class labels, one in each row\n");
+		    exit(1);
+		    break;
+	case '?':   printf("unrecognised option, use -h for help\n");
+		    exit(1);
+	}
+    }
+
+    /*  Initialise  */
+
+    GetNames();
+    
+    GetData(TRAIN ? ".data" : ".test");
+    printf("\nRead %d cases (%d attributes) from %s.%s\n",
+	   MaxItem+1, MaxAtt+1, FileName, (TRAIN ? "data" : "test"));
+
+    if (IGNOREMVCLASS == 1)
+      printf("\nIgnored %d records with '?' as class label\n", NrMVClass);
+    else if ((IGNOREMVCLASS == 2) || (NrMVClass > 0))
+      printf("\nReplaced '?' in %d cases with first class label\n", NrMVClass);
+    /* read the tree */
+    DecisionTree = GetTree((UNPRUNED ? ".unpruned" : ".tree"));
+    if ( TRACE ) PrintTree(DecisionTree);
+
+    /*GetData(".test");*/
+    printf("\nGenerate labels file from %s data (%d items):\n", 
+	   (TRAIN ? "training" : "test"), MaxItem+1);
+    
+    if (ModelSuffix == 0)
+      sprintf(suffixbuf,".labs");
+    else
+      sprintf(suffixbuf,"%s.labs",ModelSuffix);
+    WriteLabs(suffixbuf);
+
+
+    exit(0);
+}
+
+
+
+
diff -Nu ../c45rel8/R8/Src/trees.c ./trees.c
--- ../c45rel8/R8/Src/trees.c	Fri Feb 28 23:52:09 2003
+++ ./trees.c	Fri Feb 28 23:52:09 2003
@@ -9,10 +9,11 @@
 #include "defns.i"
 #include "types.i"
 #include "extern.i"
-
+static char * rcsid = "@(#)$Id: trees.c,v 1.8 1999/03/10 17:04:39 johann Exp $";
 
 #define	Tab		"|   "
 #define	TabSize		4
+
 #define	Width		80	/* approx max width of printed trees */
 
 	/*  If lines look like getting too long while a tree is being
@@ -25,6 +26,11 @@
 FILE	*TRf = 0, *fopen();	/* file pointer for tree i/o */
 char	Fn[500];		/* file name */
 
+extern Boolean PRINTTREE;
+
+extern String ModelSuffix;
+
+char suffixbuf[256];
 
 
 /*************************************************************************/
@@ -40,18 +46,23 @@
 {
     short s;
 
-    Subtree=0;
-    printf("Decision Tree:\n");
-    Show(T, 0);
-    printf("\n");
-
-    ForEach(s, 1, Subtree)
+    if (PRINTTREE) 
     {
-	printf("\n\nSubtree [S%d]\n", s);
+      Subtree=0;
+      printf("Decision Tree");
+      if (TARGETCOLUMN!=0) printf(" for target %s", ClassAttr);
+      printf(":\n");
+      Show(T, 0);
+      printf("\n");
+
+      ForEach(s, 1, Subtree)
+      {
+  	printf("\n\nSubtree [S%d]\n", s);
 	Show(Subdef[s], 0);
 	printf("\n");
+      }
+      printf("\n");
     }
-    printf("\n");
 }
 
 
@@ -276,7 +287,6 @@
 }
 
 
-
 /*************************************************************************/
 /*									 */
 /*	Save entire decision tree T in file with extension Extension	 */
@@ -291,6 +301,7 @@
 {
     static char *LastExt="";
 
+
     if ( strcmp(LastExt, Extension) )
     {
 	LastExt = Extension;
@@ -298,9 +309,18 @@
 	if ( TRf ) fclose(TRf);
 
 	strcpy(Fn, FileName);
-	strcat(Fn, Extension);
-	if ( ! ( TRf = fopen(Fn, "w") ) )
-	    Error(0, Fn, " for writing");
+
+	if (ModelSuffix == 0)
+	  sprintf(suffixbuf,"%s",Extension);
+	else
+	  sprintf(suffixbuf,"%s%s",ModelSuffix,Extension);
+	
+	strcat(Fn, suffixbuf);
+	#ifdef __DOS__
+	  if ( ! ( TRf = fopen(Fn, "wb") ) ) Error(0, Fn, " for writing");
+        #else
+	  if ( ! ( TRf = fopen(Fn, "w") ) ) Error(0, Fn, " for writing");
+        #endif
     }
 
     putc('\n', TRf);
@@ -385,9 +405,18 @@
 
 	if ( TRf ) fclose(TRf);
 
+	if (ModelSuffix == 0)
+	  sprintf(suffixbuf,"%s",Extension);
+	else
+	  sprintf(suffixbuf,"%s%s",ModelSuffix,Extension);
+	
 	strcpy(Fn, FileName);
-	strcat(Fn, Extension);
-	if ( ! ( TRf = fopen(Fn, "r") ) ) Error(0, Fn, "");
+	strcat(Fn, suffixbuf);
+	#ifdef __DOS__
+	  if ( ! ( TRf = fopen(Fn, "rb") ) ) Error(0, Fn, "");
+	#else
+	  if ( ! ( TRf = fopen(Fn, "r") ) ) Error(0, Fn, "");
+        #endif
     }
 
     if ( ! TRf || getc(TRf) == EOF ) return Nil;
diff -Nu ../c45rel8/R8/Src/types.i ./types.i
--- ../c45rel8/R8/Src/types.i	Fri Feb 28 23:52:09 2003
+++ ./types.i	Fri Feb 28 23:52:09 2003
@@ -5,7 +5,6 @@
 /*									 */
 /*************************************************************************/
 
-
 typedef  char	Boolean, *String, *Set;
 
 typedef  int	ItemNo;		/* data item number */
@@ -26,8 +25,12 @@
 #define  DVal(Case,Attribute)   Case[Attribute]._discr_val
 #define  Class(Case)		Case[MaxAtt+1]._discr_val
 
-#define  Unknown  -999		/* unknown value for continuous attribute */
-
+#ifdef __GNUC__
+#include<float.h>
+#define  Unknown  FLT_MIN
+#else
+#define  Unknown  1.1E-38   /* unknown value for continuous attribute */
+#endif
 
 #define  BrDiscr	1	/* node types:	branch */
 #define  ThreshContin	2	/*		threshold cut */
diff -Nu ../c45rel8/R8/Src/userint.c ./userint.c
--- ../c45rel8/R8/Src/userint.c	Fri Feb 28 23:52:09 2003
+++ ./userint.c	Fri Feb 28 23:52:09 2003
@@ -10,6 +10,7 @@
 #include "types.i"
 #include "extern.i"
 
+static char * rcsid = "@(#)$Id: userint.c,v 1.4 1999/03/10 17:04:41 johann Exp $";
 
 typedef	struct	ValRange	*RangeDescRec;
 struct	ValRange
diff -Nu ../c45rel8/R8/Src/verbose.1 ./verbose.1
--- ../c45rel8/R8/Src/verbose.1	Thu Jan  1 01:00:00 1970
+++ ./verbose.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,212 @@
+.TH C4.5 1
+.SH NAME
+A guide to the verbose output of the C4.5 decision tree generator
+
+.SH DESCRIPTION
+This document explains the output of the program
+.I C4.5
+when it is run with the verbosity level (option
+.BR v )
+set to values from 1 to 3.
+
+.SH TREE BUILDING
+
+.B Verbosity level 1
+
+To build a decision tree from a set of data items each of which belongs
+to one of a set of classes,
+.I C4.5
+proceeds as follows:
+.IP "    1." 7
+If all items belong to the same class, the decision
+tree is a leaf which is labelled with this class.
+.IP "    2."
+Otherwise,
+.I C4.5
+attempts to find the best attribute
+to test in order to divide the data items into
+subsets, and then builds a subtree from each subset
+by recursively invoking this procedure for each one.
+.HP 0
+The best attribute to branch on at each stage is selected by
+determining the information gain of a split on each of the attributes.
+If the selection criterion being used is GAIN (option
+.BR g ),
+the best
+attribute is that which divides the data items with the highest gain
+in information, whereas if the GAINRATIO criterion (the default) is
+being used (and the gain is at least the average gain across all
+attributes), the best attribute is that with the highest ratio of
+information gain to potential information.
+
+For discrete-valued attributes, a branch corresponding to each value of
+the attribute is formed, whereas for continuous-valued attributes, a
+threshold is found, thus forming two branches.
+If subset tests are being used (option
+.BR s ),
+branches may be formed
+corresponding to a subset of values of a discrete attribute being tested.
+
+The verbose output shows the number of items from which a tree is being
+constructed, as well as the total weight of these items.  The weight
+of an item is the probability that the item would reach this point in the
+tree and will be less than 1.0 for items with an unknown value
+of some previously-tested attribute.
+
+Shown for the best attribute is:
+
+    cut  -  threshold (continuous attributes only)
+    inf  -  the potential information of a split
+    gain -  the gain in information of a split
+    val  -  the gain or the gain/inf (depending on the
+selection criterion)
+
+Also shown is the proportion of items at this point in the tree
+with an unknown value for that attribute.  Items with an unknown value
+for the attribute being tested are distributed across all values
+in proportion to the relative frequency of these values in the
+set of items being tested.
+
+If no split gives a gain in information, the set of items is made
+into a leaf labelled with the most frequent class of items reaching
+this point in the tree, and the message:
+
+	no sensible splits  
+.IR r1 / r2
+
+is given, where
+.I r1
+is the total weight of items reaching this point in the tree, and
+.I r2
+is the weight of these which don't belong to the class of this leaf.
+
+If a subtree is found to misclassify
+at least as many items as does replacing the subtree with a leaf, then
+the subtree is replaced and the following message given:
+
+	Collapse tree for
+.I n
+items to leaf
+.I c
+
+where
+.I c
+is the class assigned to the leaf.
+
+
+.B Verbosity level 2
+
+When determining the best attribute to test,
+also shown are the threshold (continuous attributes only),
+information gain and potential information for a split on
+each of the attributes.
+If a test on a continuous attribute has no gain or there are
+insufficient cases
+with known values of the attribute on which
+to base a test, appropriate messages are given.
+(Sufficient here means at least twice MINOBJS, an integer
+which defaults to 2 but can be set with option
+.BR m.)
+The average gain across all attributes is also shown.
+
+If subset tests on discrete attributes are being used,
+for each attribute being examined, the combinations of
+attribute values that are made (i.e. at each stage, the
+combination with highest gain or gain ratio) and the
+potential info, gain and gain or gain ratio are shown.
+
+
+.B Verbosity level 3
+
+When determining the best attribute to test,
+also shown is the frequency distribution table showing
+the total weight of items of each class with:
+
+    - each value of the attribute (discrete attributes), or
+    - values below and above the threshold (contin atts), or
+    - values in each subset formed so far (subset tests).
+
+
+
+.SH TREE PRUNING
+
+.B Verbosity level 1
+
+After the entire decision tree has been constructed,
+.I C4.5
+recursively
+examines each subtree to determine whether replacing it with
+a leaf or a branch would be beneficial.
+(Note: the numbers treated below as counts of items actually
+refer to the total weight of the items mentioned.)
+
+Each leaf is shown as:
+
+.IR        c ( r1 : r2 /
+.IR r3 )
+
+  with:
+        \fIc\fR   -  the most frequent class at the leaf
+        \fIr1\fR  -  the number of items at the leaf
+        \fIr2\fR  -  misclassifications at the leaf
+        \fIr3\fR  -  \fIr2\fR adjusted for additional errors
+
+Each test is shown as:
+
+.IR        att :[ n1 "%  N=" r4 tree=
+.IR r5  leaf= r6 +
+.IR r7  br[ n2 ]= r8 ]
+
+  with:
+        \fIn1\fR  -  percentage of egs at this subtree that are misclassified
+        \fIr4\fR  -  the number of items in the subtree
+        \fIr5\fR  -  misclassifications of this subtree
+        \fIr6\fR  -  misclassifications if this was a leaf
+        \fIr7\fR  -  adjustment to \fIr6\fR for additional errors
+        \fIn2\fR  -  number of the largest branch
+        \fIr8\fR  -  total misclassifications if subtree is replaced by largest branch
+
+If replacing the subtree with a leaf or the largest branch
+reduces the number of errors, then the subtree is replaced
+by whichever of these results in the least number of errors.
+
+
+.SH THRESHOLD SOFTENING
+
+.B Verbosity level 1
+
+In softening the thresholds of tests on continuous attributes
+(option
+.BR p ),
+upper and lower bounds for each test are calculated.
+For each such test, the following are shown:
+.IP "  *" 4
+Base errors - the number of items misclassified when the threshold has
+its original value
+.IP "  *"
+Items - the number of items tested (with a known value for this
+attribute)
+.IP "  *"
+se - the standard deviation of the number of errors
+.HP 0
+For each of the different attribute values, shown are:
+.IP "  *" 4
+Val <=   - the attribute value 
+.IP "  *"
+Errors   - the errors with this value as threshold
+.IP "  *"
++Errors  - Errors - Base errors
+.IP "  *"
++Items   - the number of items between this value and the original
+threshold
+.IP "  *"
+Ratio    - Ratio of +Errors to +Items
+.HP 0
+The lower and upper bounds are then calculated so that the
+number of errors with each as threshold would be one standard
+deviation above the base errors.
+
+
+.SH SEE ALSO
+
+c4.5(1)
diff -Nu ../c45rel8/R8/Src/verbrules.1 ./verbrules.1
--- ../c45rel8/R8/Src/verbrules.1	Thu Jan  1 01:00:00 1970
+++ ./verbrules.1	Fri Feb 28 23:52:09 2003
@@ -0,0 +1,139 @@
+.TH C4.5 1
+.SH NAME
+A guide to the verbose output of the C4.5 production rule generator
+
+.SH DESCRIPTION
+This document explains the output of the program
+.I C4.5rules
+when it is run
+with the verbosity level (option
+.BR v )
+set to values from 1 to 3.
+.I C4.5rules
+converts unpruned decision trees into sets of pruned production
+rules.  Each set of rules is then sifted to find a subset of the
+rules which perform as well or better on the training data (see
+.IR c4.5rules(1) ).
+
+.SH RULE PRUNING
+
+.B Verbosity level 1
+
+A decision tree is converted to a set of production rules
+by forming a rule corresponding to each path from the
+root of the tree to each of its leaves.
+After each rule is extracted from the tree, it is examined
+to see whether the rule can be generalised by dropping
+conditions.
+
+For each rule, the verbose output shows the following figures
+for the rule as it stands, and for each of the rules that would
+be formed by dropping any one of the conditions:
+
+        Miss - no. of items misclassified by the rule
+        Hit  - no. of items correctly classified by the rule
+        Pess - the pessimistic error rate of the rule
+                 (i.e. 100*(misses+1)/(misses+hits+2))
+        Gain - the information gain of the rule
+        Absent condition - the condition being ignored
+
+If there are any conditions whose deletion brings about rules with
+pessimistic error rate less than the default error rate,
+and gain greater than that of the rule as it stands,
+then the one of these with the lowest pessimistic error rate
+is dropped.  When this happens, the message:
+
+	eliminate test \fId\fR
+
+is given and the new rule without condition \fId\fR
+is examined, and so on.
+
+When the rule has been pruned, either the rule is displayed,
+or the message:
+
+	duplicates rule \fIn\fR
+
+is given, where \fIn\fR is an identical rule already produced,
+and so the new rule is not added, or the message:
+
+	too inaccurate
+
+is given, indicating that the pessimistic error rate of the
+pruned rule is more than 50%, or more than the proportion of
+the items that are of the rule's class, and so the rule is
+not added.
+
+
+.SH RULE SIFTING
+
+.B Verbosity level 1
+
+The set of pruned rules for each class is then examined.
+Starting with no rules in the ruleset, the following
+process is repeated until no rules can be added or dropped.
+.IP "    1." 7
+If there are rules whose omission would not lead
+to an increase in the number of items misclassified,
+then the least useful of these is dropped.
+.IP "    2."
+Otherwise, if there are rules which lead to a decrease
+in the number of items misclassified, then the one
+with the least counterexamples is added.
+.TP 0
+This is shown in the output as:
+
+    Action  -  the number of the rule added or dropped
+    Change  -  the advantage attributable to the rule
+    Worth   -  the included rules for this class as:
+
+.IR                n1 [ n2 | n3 =
+.IR r1 ]
+
+    with:
+.IP "        \fIn1\fR" 11
+- the rule number
+.IP "        \fIn2\fR"
+- the number of items that correctly
+fire this rule and are not covered by any other included rule
+.IP "        \fIn3\fR"
+- the number of items that incorrectly
+fire this rule and are not covered by any other included rule
+.IP "        \fIr1\fR
+- the advantage attributable to the
+rule
+.HP 0
+After the rules have been sifted, the number of items of
+each class that are not covered by any rules is shown,
+and the default class is set to the class with the most
+uncovered items.
+
+
+.B Verbosity level 2
+
+When sifting rules for a particular class, the Worth of each rule
+which is for that class but not included in the ruleset, 
+is shown at each stage of the process.
+
+.SH RULE SORTING
+
+.B Verbosity level 1
+
+The rules that are left are then sorted, starting with those
+that are for the class with the least number of false positives.
+The verbose output shows the number of false positives for each
+class (i.e. the number of items misclassified as being of this
+class).
+Within a class, rules with the greatest advantage are put first.
+
+.SH RULESET EVALUATION
+
+.B Verbosity level 3
+
+When evaluating a ruleset, shown are the attribute values,
+given class and class given by the ruleset for each
+item that is misclassified.
+
+
+.SH SEE ALSO
+
+c4.5(1), c4.5rules(1)
diff -Nu ../c45rel8/R8/Src/xval-prep.c ./xval-prep.c
--- ../c45rel8/R8/Src/xval-prep.c	Fri Feb 28 23:52:09 2003
+++ ./xval-prep.c	Fri Feb 28 23:52:09 2003
@@ -14,6 +14,7 @@
 #include <math.h>
 #include <stdio.h>
 
+static char * rcsid = "@(#)$Id: xval-prep.c,v 1.2 1999/03/10 17:04:42 johann Exp $";
 
 long	random();
 #define	randf			((random()&2147483647) / 2147483648.0)
diff -Nu ../c45rel8/R8/Src/xval.sh ./xval.sh
--- ../c45rel8/R8/Src/xval.sh	Fri Feb 28 23:52:09 2003
+++ ./xval.sh	Thu Jan  1 01:00:00 1970
@@ -1,84 +0,0 @@
-#csh
-
-#---------------------------------------------------------------------
-# N-way cross-validation script
-#---------------------------------------------------------------------
-#
-# invocation:
-#   csh xval.sh filestem N [options for c4.5 and c4.5rules] [suffix]
-#
-# individual results from each block are left in
-#     filestem.[rt]o*[suffix],
-# averages over all blocks in
-#     filestem.[rt]res[suffix]
-#---------------------------------------------------------------------
-
-#	sort the options into result suffix and control options for the programs
-#	Note: for options with values, there must be no space between the option
-#	name and value; e.g. "-v1", not "-v 1"
-
-set treeopts =
-set ruleopts =
-set suffix =
-
-foreach i ( $argv[3-] )
-  switch ( $i )
-  case "+*":
-    set suffix = $i
-    breaksw
-  case "-v*":
-  case "-c*":
-    set treeopts = ($treeopts $i)
-    set ruleopts = ($ruleopts $i)
-    breaksw
-  case "-p":
-  case "-t*":
-  case "-w*":
-  case "-i*":
-  case "-g":
-  case "-s":
-  case "-m*":
-    set treeopts = ($treeopts $i)
-    breaksw
-  case "-r*":
-  case "-F*":
-  case "-a":
-    set ruleopts = ($ruleopts $i)
-    breaksw
-  default:
-    echo "unrecognised or inappropriate option" $i
-    exit
-  endsw
-end
-
-#	prepare the data for cross-validation
-
-cat $1.data $1.test | xval-prep $2 >XDF.data
-cp /dev/null XDF.test
-ln $1.names XDF.names
-rm $1.[rt]o[0-9]*$suffix
-set junk = `wc XDF.data`
-set examples = $junk[1]
-set large = `expr $examples % $2`
-set segsize = `expr \( $examples / $2 \) + 1`
-
-#	perform the cross-validation trials
-
-set i = 0
-while ( $i < $2 )
-  if ( $i == $large ) set segsize = `expr $examples / $2`
-  cat XDF.test XDF.data | split -`expr $examples - $segsize`
-  mv xaa XDF.data
-  mv xab XDF.test
-
-  c4.5 -f XDF -u $treeopts >$1.to$i$suffix
-  c4.5rules -f XDF -u $ruleopts >$1.ro$i$suffix
-
-  @ i++
-end
-
-#	remove the temporary files and summarize results
-
-rm -f XDF.*
-cat $1.to[0-9]*$suffix | grep "<<" | average >$1.tres$suffix
-cat $1.ro[0-9]*$suffix | grep "<<" | average >$1.rres$suffix
