com.rapidminer.operator.learner.igss.hypothesis
Class Rule

java.lang.Object
  extended by com.rapidminer.operator.learner.igss.hypothesis.Hypothesis
      extended by com.rapidminer.operator.learner.igss.hypothesis.Rule
All Implemented Interfaces:
java.io.Serializable

public class Rule
extends Hypothesis

Objects of this class represent a conjunctive rule. All abstract methods of the superclass Hypothesis are implemented.

Author:
Dirk Dach
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.rapidminer.operator.learner.igss.hypothesis.Hypothesis
coveredWeight, createAllHypothesis, FIRST_TYPE_INDEX, HYPOTHESIS_SPACE_TYPES, LAST_TYPE_INDEX, NEGATIVE_CLASS, POSITIVE_CLASS, positiveWeight, rejectionSampling, TYPE_RULE
 
Constructor Summary
Rule(Attribute[] regularAttributes, Attribute label, boolean rejectionSampling, boolean createAll)
          Creates a new rule,initializes the regularAttributes and the literals attribute.
Rule(Literal[] literals, int prediction)
          Construct a new rule with the given literals.
Rule(Literal literal, int prediction)
          Construct a new rule with one literal.
 
Method Summary
 boolean applicable(Example e)
          Test if the rule is applicable to the given examples without updating the corresponding value.
 void apply(Example e)
          Applies the rule to the given examples.
 boolean canBeRefined()
          Returns true only if this hypothesis can still be refined.
 Hypothesis clone()
          Clones the rule with covered and positive weight.
 boolean equals(java.lang.Object o)
          Returns true if the two rules have the same premise and make the same perdiction.
 int getComplexity()
          Returns the lenght of the premise of the rule.
 Literal[] getLiterals()
          Returns the literals in the premise of this rule.
 int getPrediction()
          Returns the index of prediction of this rule
 int hashCode()
           
 java.util.LinkedList<Hypothesis> init(int minComplexity)
          Creates all rules with length<=minComplexity.
 java.util.LinkedList<Hypothesis> refine()
          Creates all successors of the rule that have one more literal.
 java.lang.String toString()
          Returns a String representation of the rule.
 
Methods inherited from class com.rapidminer.operator.learner.igss.hypothesis.Hypothesis
getCoveredWeight, getLabel, getPositiveWeight, reset, setCoveredWeight, setPositiveWeight
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Rule

public Rule(Attribute[] regularAttributes,
            Attribute label,
            boolean rejectionSampling,
            boolean createAll)
Creates a new rule,initializes the regularAttributes and the literals attribute.


Rule

public Rule(Literal literal,
            int prediction)
Construct a new rule with one literal.


Rule

public Rule(Literal[] literals,
            int prediction)
Construct a new rule with the given literals.

Method Detail

clone

public Hypothesis clone()
Clones the rule with covered and positive weight.

Specified by:
clone in class Hypothesis

apply

public void apply(Example e)
Applies the rule to the given examples.

Specified by:
apply in class Hypothesis

applicable

public boolean applicable(Example e)
Test if the rule is applicable to the given examples without updating the corresponding value.

Specified by:
applicable in class Hypothesis

init

public java.util.LinkedList<Hypothesis> init(int minComplexity)
Creates all rules with length<=minComplexity.

Specified by:
init in class Hypothesis

refine

public java.util.LinkedList<Hypothesis> refine()
Creates all successors of the rule that have one more literal.

Specified by:
refine in class Hypothesis

canBeRefined

public boolean canBeRefined()
Returns true only if this hypothesis can still be refined.

Specified by:
canBeRefined in class Hypothesis

getPrediction

public int getPrediction()
Returns the index of prediction of this rule

Specified by:
getPrediction in class Hypothesis

getComplexity

public int getComplexity()
Returns the lenght of the premise of the rule.

Specified by:
getComplexity in class Hypothesis

equals

public boolean equals(java.lang.Object o)
Returns true if the two rules have the same premise and make the same perdiction.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns a String representation of the rule.

Overrides:
toString in class java.lang.Object

getLiterals

public Literal[] getLiterals()
Returns the literals in the premise of this rule.



Copyright © 2001-2009 by Rapid-I