clarion.system
Class RuleRefiner

java.lang.Object
  extended by clarion.system.RuleRefiner

public final class RuleRefiner
extends java.lang.Object

This class implements a rule refiner within CLARION.

Usage:

This class contains static methods used to handle the refinement (generalization and specialization) of any rules that extend the RefineableRule class.

The rule refiner has two options for calculating information gain (as part of rule refinement). Those options are:

The first option is just the standard formula for calculating information gain. The second method method is the equivalent to: IG(A, Perfect) where "Perfect" is assumed to be a rule that has perfect match statistics (all positive). When a rule is considered "perfect", the log equation that is used to calculate information gain for that rule will approach 0. Therefore this method for calculating information gain needs to only calculate the log equation for the rule A.

Classes that currently instantiate a rule extractor are:

This class contains both global (static) and local constants. The default is to use the local constants. If you want to change any of the global constants, you need to do so before any instances of this class are initialized.

Version:
6.0.4
Author:
Nick Wilson

Nested Class Summary
static class RuleRefiner.IG_OPTIONS
          The options that can be used when calculating information gain for IG(C,ALL)
 
Field Summary
 double C1
          Constant for Information Gain
 double C2
          Constant for Information Gain
 double GENERALIZATION_THRESHOLD1
          The threshold IG(C,All) must pass for a rule to be generalized
 double GENERALIZATION_THRESHOLD2
          The threshold IG(C',C) must pass for a rule to be generalized
static double GLOABAL_C2
          Constant for Information Gain
static double GLOBAL_C1
          Constant for Information Gain
static double GLOBAL_GENERALIZATION_THRESHOLD1
          The threshold IG(C,All) must pass for a rule to be generalized
static double GLOBAL_GENERALIZATION_THRESHOLD2
          The threshold IG(C',C) must pass for a rule to be generalized
static RuleRefiner.IG_OPTIONS GLOBAL_IG_OPTION
          The option to use when calculation information gain for IG(C,ALL)
static double GLOBAL_SPECIALIZATION_THRESHOLD1
          The threshold IG(C,All) must be below for a rule to be specialized
static double GLOBAL_SPECIALIZATION_THRESHOLD2
          The threshold IG(C',C) must be below for a rule to be specialized
 RuleRefiner.IG_OPTIONS IG_OPTION
          The option to use when calculation information gain for IG(C,ALL)
 double SPECIALIZATION_THRESHOLD1
          The threshold IG(C,All) must be below for a rule to be specialized
 double SPECIALIZATION_THRESHOLD2
          The threshold IG(C',C) must be below for a rule to be specialized
 
Constructor Summary
RuleRefiner()
           
 
Method Summary
 double calculateInformationGain(AbstractRule A)
          Calculates the information gain using the match statistics of the specified rule.
 double calculateInformationGain(AbstractRule A, AbstractRule B)
          Calculates the information gain using the match statistics of two specified rules.
 AbstractRule generalize(AbstractRule R)
          Generalizes the specified rule (if possible).
 AbstractRule specialize(AbstractRule R)
          Specializes the specified rule (if possible).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GLOBAL_IG_OPTION

public static RuleRefiner.IG_OPTIONS GLOBAL_IG_OPTION
The option to use when calculation information gain for IG(C,ALL)


IG_OPTION

public RuleRefiner.IG_OPTIONS IG_OPTION
The option to use when calculation information gain for IG(C,ALL)


GLOBAL_GENERALIZATION_THRESHOLD1

public static double GLOBAL_GENERALIZATION_THRESHOLD1
The threshold IG(C,All) must pass for a rule to be generalized


GENERALIZATION_THRESHOLD1

public double GENERALIZATION_THRESHOLD1
The threshold IG(C,All) must pass for a rule to be generalized


GLOBAL_GENERALIZATION_THRESHOLD2

public static double GLOBAL_GENERALIZATION_THRESHOLD2
The threshold IG(C',C) must pass for a rule to be generalized


GENERALIZATION_THRESHOLD2

public double GENERALIZATION_THRESHOLD2
The threshold IG(C',C) must pass for a rule to be generalized


GLOBAL_SPECIALIZATION_THRESHOLD1

public static double GLOBAL_SPECIALIZATION_THRESHOLD1
The threshold IG(C,All) must be below for a rule to be specialized


SPECIALIZATION_THRESHOLD1

public double SPECIALIZATION_THRESHOLD1
The threshold IG(C,All) must be below for a rule to be specialized


GLOBAL_SPECIALIZATION_THRESHOLD2

public static double GLOBAL_SPECIALIZATION_THRESHOLD2
The threshold IG(C',C) must be below for a rule to be specialized


SPECIALIZATION_THRESHOLD2

public double SPECIALIZATION_THRESHOLD2
The threshold IG(C',C) must be below for a rule to be specialized


GLOBAL_C1

public static double GLOBAL_C1
Constant for Information Gain


GLOABAL_C2

public static double GLOABAL_C2
Constant for Information Gain


C1

public double C1
Constant for Information Gain


C2

public double C2
Constant for Information Gain

Constructor Detail

RuleRefiner

public RuleRefiner()
Method Detail

generalize

public AbstractRule generalize(AbstractRule R)
Generalizes the specified rule (if possible).

Parameters:
R - The rule to Generalize.
Returns:
R if the rule does not meet the criteria for generalization (or if the rule is not generalizable), or a generalized rule if R meets the criteria for generalization.

specialize

public AbstractRule specialize(AbstractRule R)
Specializes the specified rule (if possible).

Parameters:
R - The rule to specialize.
Returns:
Null if the rule cannot be specialized, R if the rule does not meet the criteria for specialization, or a specialized rule if R meets the criteria for specialization.

calculateInformationGain

public double calculateInformationGain(AbstractRule A,
                                       AbstractRule B)
Calculates the information gain using the match statistics of two specified rules.

Parameters:
A - The first rule.
B - The second rule.
Returns:
The information gain measure.

calculateInformationGain

public double calculateInformationGain(AbstractRule A)
Calculates the information gain using the match statistics of the specified rule. The result from this method is the equivalent to: IG(A, Perfect) where "Perfect" is assumed to be a rule that has perfect match statistics (all positive). When a rule is considered "perfect", the log equation that is used to calculate information gain for that rule will approach 0. Therefore this method for calculating information gain needs only calculate the log equation for the rule A.

Parameters:
A - The rule to use for calculating information gain against the "perfect" rule.
Returns:
The information gain measure.