/* ====================================================================== David W. Aha NGE: nge.h: Data structures file for NGE A note on representation: The "exemplars" array is the most important. For numeric-valued attributes, only the first 2 values will be used, representing "lower" and "upper" respectively. However, all the values will be used for symbolic attributes, where the INCLUDED value denotes that the attribute value is included and the NOT_INCLUDED value denotes otherwise. ====================================================================== */ /*==== Pre-processor commands to handle storage multi-accessing problem. ====*/ /*==== General idea: only the main source file reads these declarations as is. All others read them as external declarations. ====*/ #ifdef MAIN #define EXTERN #else #define EXTERN extern #endif /*==== Accessing Library Files ====*/ #include #include #include /*==== Maximum settings ====*/ #define MAX_NUMBER_OF_ATTRIBUTES 129 /* Includes concept */ #define MAX_NUMBER_OF_INSTANCES 1000 /* Max(tr,te)!!!! */ #define MAX_NUMBER_OF_TRAINING_INSTANCES 1000 #define MAX_NUMBER_OF_EXEMPLARS 1000 /* Should be same */ #define MAX_NUMBER_OF_TESTING_INSTANCES 1000 #define MAX_NUMBER_OF_SYMBOLIC_VALUES_PER_ATTRIBUTE 10 /* Must be > 1 */ #define MAX_LINE_LENGTH 300 #define MAX_NAME_LENGTH 500 #define MAX_FILENAME_SIZE 100 /*==== Simple constants ====*/ #define NUMBER_OF_REQUIRED_INPUTS 6 #define NUMERIC_TYPE 0 #define SYMBOLIC_TYPE 1 #define FALSE 0 #define TRUE 1 #define TRAINING 0 /* Used when reading and compute_distances() */ #define TESTING 1 /* Used when reading and compute_distances() */ #define UNKNOWN_VALUE -1000.0 /* Used when reading */ #define NOT_INCLUDED 0.0 /* Used in exemplars[] for symbolic values */ #define INCLUDED 1.0 /* Used in exemplars[] for symbolic values */ #define LOWER 0 /* Final index for exemplars[] array */ #define UPPER 1 /* Final index for exemplars[] array */ #define CORRECT 0 /* Parameter passing for generalize() */ #define INCORRECT 1 /* Parameter passing for generalize() */ /*==== Global variables ====*/ EXTERN char namesfile[MAX_FILENAME_SIZE], /* Documentation file on instances */ trainingfile[MAX_FILENAME_SIZE], /* Training set file name */ testingfile[MAX_FILENAME_SIZE], /* Test file name */ outputfile[MAX_FILENAME_SIZE]; /* Output file name */ EXTERN int greedy, /* Input */ testrate, /* Input */ testlast, /* Input */ number_of_seeds, /* Input */ number_of_attributes, /* Read */ attribute_type[MAX_NUMBER_OF_ATTRIBUTES], /* Read */ num_testing_instances, /* Read */ num_training_instances, /* Read */ num_values[MAX_NUMBER_OF_ATTRIBUTES], /* Read */ number_of_uses[MAX_NUMBER_OF_EXEMPLARS], /* Computed */ number_correct[MAX_NUMBER_OF_EXEMPLARS], /* Computed */ used_as_a_seed[MAX_NUMBER_OF_TRAINING_INSTANCES], /* Computed */ number_of_exemplars; /* Computed */ EXTERN float feature_adjustment_rate, /* Input */ my_infinity; /* Constant */ /*==== Instance-holding and related arrays (keeping it simple, stupid) ====*/ EXTERN int class[MAX_NUMBER_OF_EXEMPLARS]; EXTERN float training_instances[MAX_NUMBER_OF_TRAINING_INSTANCES][MAX_NUMBER_OF_ATTRIBUTES], testing_instances[MAX_NUMBER_OF_TESTING_INSTANCES][MAX_NUMBER_OF_ATTRIBUTES], exemplars[MAX_NUMBER_OF_EXEMPLARS][MAX_NUMBER_OF_ATTRIBUTES][MAX_NUMBER_OF_SYMBOLIC_VALUES_PER_ATTRIBUTE]; /*==== Holds distances between current training instance and all others. ====*/ EXTERN float distances[MAX_NUMBER_OF_INSTANCES]; EXTERN int nearest_neighbors[MAX_NUMBER_OF_INSTANCES]; EXTERN float feature_weights[MAX_NUMBER_OF_ATTRIBUTES]; /* Computed */