|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--shared.Globals
|
+--shared.Categorizer
|
+--id3.NodeCategorizer
An abstract base class categorizer for categorizers that may sit in nodes of decision trees, graphs, etc. Categorizers of this sort generally categorize by making a decision about the instance, and then asking one or more other categorizers in the graph to categorize. The recursion ends when a NodeCategorizer can decide on the category (or distribution, in the case of scoring) without consulting other categorizers.
| Constructor Summary | |
NodeCategorizer(int noCat,
java.lang.String dscr,
Schema schema)
Constructor. |
|
| Method Summary | |
void |
add_instance_loss(Instance instance,
CatDist pred)
Updates the loss information for this node to reflect the node's performance on the given instance, and the given prediction. |
abstract AugCategory |
branch(Instance inst)
Traverses the graph of nodes from this NodeCategorizer to determine the category the given instance should be predicted as. |
AugCategory |
categorize(Instance instance)
Categorize an instance. |
void |
distribute_instances(InstanceList il,
double pruningFactor,
DoubleRef pessimisticErrors,
int ldType,
double leafDistParameter,
double[] parentWeightDist,
boolean saveOriginalDistr)
Recomputes the distribution of the categorizer according to the given instance list, splits it, and redistributes the split lists among the child categorizers. |
NodeCategorizer |
get_child_categorizer(AugCategory branch)
Returns the child categorizer of this node that is found by following the edge with the given label. |
NodeCategorizer |
get_child_categorizer(Instance inst)
Retrieves the appropriate categorizer one level down in the graph, obtained by following the edge appropriate for the instance provided. |
protected CGraph |
get_graph()
Returns the graph for this NodeCategorizer. |
NodeLoss |
get_loss()
Returns the loss information. |
protected Node |
get_node()
Returns the node for this NodeCategorizer. |
boolean |
in_graph()
Returns TRUE if a graph has been set for this NodeCategorizer, FALSE otherwise. |
void |
reset_node_loss()
Clears the loss information. |
CatDist |
score(Instance inst)
Score an instance. |
CatDist |
score(Instance inst,
boolean addLoss)
Score an instance. |
void |
set_graph_and_node(CGraph aGraph,
Node aNode)
Install the graph and node into the object. |
InstanceList[] |
split_instance_list(InstanceList il)
Splits the instance list according to the value returned by branch() for each instance. |
void |
stop()
Prints an empty string to System.out. |
boolean |
supports_scoring()
Returns TRUE if scoring supported by this node categorizer. |
java.lang.String |
toString()
Creates a String representation of this NodeCategorizer. |
protected void |
update_loss(double weight,
double loss)
Updates the loss information with the given values. |
| Methods inherited from class shared.Categorizer |
build_distr,
clone,
description,
display_struct,
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,
set_used_attr,
total_weight |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public NodeCategorizer(int noCat,
java.lang.String dscr,
Schema schema)
noCat - The category for this NodeCategorizer.dscr - Description of this NodeCategorizer.schema - Schema for the data this categorizer classifies.| Method Detail |
public void stop()
public java.lang.String toString()
public void reset_node_loss()
public boolean in_graph()
public InstanceList[] split_instance_list(InstanceList il)
il - The InstanceList to be split.public abstract AugCategory branch(Instance inst)
inst - The instance for which a prediction is requested.public AugCategory categorize(Instance instance)
instance - The instance to be categorized.public boolean supports_scoring()
public CatDist score(Instance inst)
inst - The instance to be scored.
public CatDist score(Instance inst,
boolean addLoss)
inst - The instance to be scored.addLoss - TRUE if the loss information is to be carried through the graph, FALSE
otherwise.
public void add_instance_loss(Instance instance,
CatDist pred)
instance - The instance to which given prediction applies.pred - The prediction of category distributions.public NodeCategorizer get_child_categorizer(AugCategory branch)
branch - The category of the edge for which the child categorizer is requested.public NodeCategorizer get_child_categorizer(Instance inst)
inst - The instance provided for determining which edge to traverse.
protected void update_loss(double weight,
double loss)
weight - The new weight value.loss - The new loss value.protected CGraph get_graph()
protected Node get_node()
public void distribute_instances(InstanceList il,
double pruningFactor,
DoubleRef pessimisticErrors,
int ldType,
double leafDistParameter,
double[] parentWeightDist,
boolean saveOriginalDistr)
il - The instance list used for recomputation.pruningFactor - The amount of pruning being done.pessimisticErrors - The pessimistic Error value.ldType - Leaf distribution type.leafDistParameter - The leaf distribution.parentWeightDist - The weight distribution of the parent categorizer.saveOriginalDistr - TRUE if the original distribution should be preserved, FALSE otherwise.
public void set_graph_and_node(CGraph aGraph,
Node aNode)
aGraph - The graph of NodeCategorizers.aNode - The node for this NodeCategorizer.public NodeLoss get_loss()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||