shared
Class TableCategorizer

java.lang.Object
  |
  +--shared.Globals
        |
        +--shared.Categorizer
              |
              +--shared.TableCategorizer

public class TableCategorizer
extends Categorizer

A TableCategorizer consists of a table of all possible instances. Instances are categorized according to label if they are found; otherwise the default category is returned. The tiebreaking order is used to break ties if multiple instances match. Assumes LabelledInstanceInfo has label of type NominalAttrInfo and all instances must be labelled.


Field Summary
protected  InstanceHashTable hashTable
          Hashtable of Instances used in this categorizer.
 
Fields inherited from class shared.Categorizer
CATEGORIZER_ID_BASE, CLASS_ATTR_CATEGORIZER, CLASS_ATTR_EQ_CATEGORIZER, CLASS_ATTR_SUBSET_CATEGORIZER, CLASS_BAD_CATEGORIZER, CLASS_BAGGING_CATEGORIZER, CLASS_CASCADE_CATEGORIZER, CLASS_CLUSTER_CATEGORIZER, CLASS_CONST_CATEGORIZER, CLASS_CONSTRUCT_CATEGORIZER, CLASS_DISC_CATEGORIZER, CLASS_DISC_NODE_CATEGORIZER, CLASS_DTREE_CATEGORIZER, CLASS_IB_CATEGORIZER, CLASS_LAZYDT_CATEGORIZER, CLASS_LEAF_CATEGORIZER, CLASS_LINDISCR_CATEGORIZER, CLASS_MAJORITY_CATEGORIZER, CLASS_MULTI_SPLIT_CATEGORIZER, CLASS_MULTITHRESH_CATEGORIZER, CLASS_NB_CATEGORIZER, CLASS_ODT_CATEGORIZER, CLASS_ONE_R_CATEGORIZER, CLASS_OPTION_CATEGORIZER, CLASS_PROJECT_CATEGORIZER, CLASS_RDG_CATEGORIZER, CLASS_STACKING_CATEGORIZER, CLASS_TABLE_CATEGORIZER, CLASS_THRESHOLD_CATEGORIZER, logOptions
 
Fields inherited from class shared.Globals
badCategorizer, CONFIDENCE_INTERVAL_Z, DBG, DEFAULT_DATA_EXT, DEFAULT_EPSILON, DEFAULT_EVAL_LIMIT, DEFAULT_LAMBDA, DEFAULT_MAX_EVALS, DEFAULT_MAX_STALE, DEFAULT_MIN_EXP_EVALS, DEFAULT_NAMES_EXT, DEFAULT_SAS_SEED, DEFAULT_SEARCH_METHOD, DEFAULT_SHOW_TEST_SET_PERF, DEFAULT_TEST_EXT, DISPLAY_NAMES, EMPTY_STRING, FIRST_CATEGORY_VAL, FIRST_NOMINAL_VAL, LEFT_NODE, MAX_NUM_CATEGORIES, Mcerr, Mcout, optionServer, optionsFileName, REAL_MAX, RIGHT_NODE, SHOW_TEST_SET_PERF_HELP, SINGLE_QUOTE, STORED_REAL_MAX, TS, UNDEFINED_INT, UNDEFINED_REAL, UNDEFINED_VARIANCE, UNKNOWN_AUG_CATEGORY, UNKNOWN_CATEGORY_VAL, UNKNOWN_NODE, UNKNOWN_NOMINAL_VAL, UNKNOWN_STORED_REAL_VAL, UNKNOWN_VAL_STR
 
Constructor Summary
TableCategorizer(InstanceList instList, int defaultCategory, java.lang.String dscr)
          Initializes the table with the given InstanceList and relays the description and number of categories to the Categorizer constructor.
 
Method Summary
 AugCategory categorize(Instance instance)
          Returns category if instance found in table, otherwise returns defaultCat.
 void display_struct(java.io.BufferedWriter stream, DisplayPref dp)
          Prints a readable representation of the categorizer to the given stream.
 void set_tiebreaking_order(int[] newOrder)
          Resets the tiebreaking order.
 
Methods inherited from class shared.Categorizer
build_distr, clone, description, get_distr, get_log_level, get_log_options, get_log_stream, get_schema, has_distr, num_categories, score, set_description, set_distr, set_log_level, set_log_options, set_log_prefixes, set_log_stream, set_original_distr, set_used_attr, supports_scoring, total_weight
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashTable

protected InstanceHashTable hashTable
Hashtable of Instances used in this categorizer.
Constructor Detail

TableCategorizer

public TableCategorizer(InstanceList instList,
                        int defaultCategory,
                        java.lang.String dscr)
Initializes the table with the given InstanceList and relays the description and number of categories to the Categorizer constructor.
Parameters:
instList - InstanceList obect containing the Instances used to populate the hash table of instances.
defaultCategory - Integer indicating the default category for this Categorizer.
dscr - String description of this Categprizer object.
Method Detail

categorize

public AugCategory categorize(Instance instance)
Returns category if instance found in table, otherwise returns defaultCat. This will return the category of the majority instances found.
Overrides:
categorize in class Categorizer
Parameters:
instance - Instance object to be categorized.
Returns:
Category of the supplied Instance object.

display_struct

public void display_struct(java.io.BufferedWriter stream,
                           DisplayPref dp)
Prints a readable representation of the categorizer to the given stream.
Overrides:
display_struct in class Categorizer
Parameters:
stream - The BufferedStream to which the representation of this Categorizer will be printed.
dp - The preferences for display.

set_tiebreaking_order

public void set_tiebreaking_order(int[] newOrder)
Resets the tiebreaking order. The tiebreaking order must follow the rules for tiebreaking orders, as set in CatDist.java
Parameters:
newOrder - The new order for tiebreaking.