id3
Class ThresholdCategorizer
java.lang.Object
|
+--shared.Globals
|
+--shared.Categorizer
|
+--id3.NodeCategorizer
|
+--id3.ThresholdCategorizer
- public class ThresholdCategorizer
- extends NodeCategorizer
Categorize an instance by comparing the value of a single attribute to a
threshold value. All instances for which the attribute is less than or equal
to the threshold value are put into one category and those for which the
attribute is greater than the threshold value are put into a second category.
The attribute must be Real.
| 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 |
ThresholdCategorizer(Schema sch,
int attributeNum,
double threshold,
java.lang.String dscr)
Construct a ThresholdCategorizer. |
|
Method Summary |
AugCategory |
branch(Instance inst)
Returns the edge label leading to the node that the given instance should use
to continue scoring or categorization. |
void |
change_threshold(double threshold)
Changes the threshold value. |
int |
class_id()
Deprecated. Use java's instanceOf function. |
void |
display_struct(java.io.BufferedWriter stream,
DisplayPref dp)
Prints a readable representation of the Categorizer to the given stream. |
java.lang.String[] |
real_edge_strings()
Builds an array of 3 strings for the labels (?, <= x, and > x) of the edges
depending from the node for which this is the categorizer. |
void |
set_used_attr(boolean[] usedAttr)
Updates usedAttr to include the attributes used in this categorizer. |
| Methods inherited from class id3.NodeCategorizer |
add_instance_loss,
categorize,
distribute_instances,
get_child_categorizer,
get_child_categorizer,
get_graph,
get_loss,
get_node,
in_graph,
reset_node_loss,
score,
score,
set_graph_and_node,
split_instance_list,
stop,
supports_scoring,
toString,
update_loss |
| 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,
set_description,
set_distr,
set_log_level,
set_log_options,
set_log_prefixes,
set_log_stream,
set_original_distr,
total_weight |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
ThresholdCategorizer
public ThresholdCategorizer(Schema sch,
int attributeNum,
double threshold,
java.lang.String dscr)
- Construct a ThresholdCategorizer.
- Parameters:
sch - The schema for information this categorizer categorizes.attributeNum - The attribute number for this threshold.threshold - The threshold value.dscr - Description of this categorizer.
change_threshold
public void change_threshold(double threshold)
- Changes the threshold value.
- Parameters:
threshold - The new threshold value.
class_id
public int class_id()
- Deprecated. Use java's instanceOf function.
- Returns the id number for this class.
- Returns:
- The class id number.
real_edge_strings
public java.lang.String[] real_edge_strings()
- Builds an array of 3 strings for the labels (?, <= x, and > x) of the edges
depending from the node for which this is the categorizer.
- Returns:
- An array of the strings built.
branch
public AugCategory branch(Instance inst)
- Returns the edge label leading to the node that the given instance should use
to continue scoring or categorization.
- Overrides:
- branch in class NodeCategorizer
- Parameters:
inst - The instance being scored.- Returns:
- Returns the category found after traversing the categorizer.
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 BufferedWriter to be printed to.dp - The display preferences.
set_used_attr
public void set_used_attr(boolean[] usedAttr)
- Updates usedAttr to include the attributes used in this categorizer.
- Overrides:
- set_used_attr in class Categorizer
- Parameters:
usedAttr - An array of used attributes. TRUE values indicate the attribute matched to that
index number is used, FALSE indicates it is not.