weka.classifiers.rules
Class ConjunctiveRule.NumericAntd

java.lang.Object
  extended byweka.classifiers.rules.ConjunctiveRule.Antd
      extended byweka.classifiers.rules.ConjunctiveRule.NumericAntd
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
ConjunctiveRule

private class ConjunctiveRule.NumericAntd
extends ConjunctiveRule.Antd

The antecedent with numeric attribute


Field Summary
protected  Attribute att
          The attribute of the antecedent
protected  double inform
          The information of this antecedent test on the growing data
protected  double maxInfoGain
          The maximum infoGain achieved by this antecedent test
private  double splitPoint
           
protected  double[] uncover
          The parameters related to the data not covered by the previous antecedents when the class is nominal
protected  double uncoverSum
          The parameter related to the meanSquaredError of the data not covered by the previous antecedents when the class is numeric
protected  double uncoverWtSq
          The parameter related to the meanSquaredError of the data not covered by the previous antecedents when the class is numeric
protected  double uncoverWtVl
          The parameter related to the meanSquaredError of the data not covered by the previous antecedents when the class is numeric
protected  double value
          The attribute value of the antecedent.
 
Constructor Summary
ConjunctiveRule.NumericAntd(Attribute a, double[] unc)
           
ConjunctiveRule.NumericAntd(Attribute a, double sq, double vl, double wts)
           
 
Method Summary
protected  double entropy(double[] value, double sum)
          Function used to calculate the entropy of given vector of values entropy = (1/sum)*{-sigma[i=1..P](Xi*log2(Xi)) + sum*log2(sum)} where P is the length of the vector
 Attribute getAttr()
           
 double getAttrValue()
           
 double getInfo()
           
 double getMaxInfoGain()
           
 double getSplitPoint()
           
 boolean isCover(Instance inst)
          Whether the instance is covered by this antecedent
 Instances[] splitData(Instances insts, double defInfo)
          Implements the splitData function.
 java.lang.String toString()
          Prints this antecedent
protected  double wtMeanSqErr(double weightedSq, double weightedValue, double sum)
          Function used to calculate the weighted mean squared error, i.e., sum[x-avg(x)]^2 based on the given elements of the formula: meanSquaredError = sum(Wi*Xi^2) - (sum(WiXi))^2/sum(Wi)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

splitPoint

private double splitPoint

att

protected Attribute att
The attribute of the antecedent


value

protected double value
The attribute value of the antecedent. For numeric attribute, value is either 0(1st bag) or 1(2nd bag)


maxInfoGain

protected double maxInfoGain
The maximum infoGain achieved by this antecedent test


inform

protected double inform
The information of this antecedent test on the growing data


uncoverWtSq

protected double uncoverWtSq
The parameter related to the meanSquaredError of the data not covered by the previous antecedents when the class is numeric


uncoverWtVl

protected double uncoverWtVl
The parameter related to the meanSquaredError of the data not covered by the previous antecedents when the class is numeric


uncoverSum

protected double uncoverSum
The parameter related to the meanSquaredError of the data not covered by the previous antecedents when the class is numeric


uncover

protected double[] uncover
The parameters related to the data not covered by the previous antecedents when the class is nominal

Constructor Detail

ConjunctiveRule.NumericAntd

public ConjunctiveRule.NumericAntd(Attribute a,
                                   double[] unc)

ConjunctiveRule.NumericAntd

public ConjunctiveRule.NumericAntd(Attribute a,
                                   double sq,
                                   double vl,
                                   double wts)
Method Detail

getSplitPoint

public double getSplitPoint()

splitData

public Instances[] splitData(Instances insts,
                             double defInfo)
Implements the splitData function. This procedure is to split the data into two bags according to the information gain of the numeric attribute value the data with missing values are stored in the last split. The maximum infoGain is also calculated.

Specified by:
splitData in class ConjunctiveRule.Antd
Parameters:
insts - the data to be split
defInfo - the default information for data
Returns:
the array of data after split

isCover

public boolean isCover(Instance inst)
Whether the instance is covered by this antecedent

Specified by:
isCover in class ConjunctiveRule.Antd
Parameters:
inst - the instance in question
Returns:
the boolean value indicating whether the instance is covered by this antecedent

toString

public java.lang.String toString()
Prints this antecedent

Specified by:
toString in class ConjunctiveRule.Antd
Returns:
a textual description of this antecedent

getAttr

public Attribute getAttr()

getAttrValue

public double getAttrValue()

getMaxInfoGain

public double getMaxInfoGain()

getInfo

public double getInfo()

wtMeanSqErr

protected double wtMeanSqErr(double weightedSq,
                             double weightedValue,
                             double sum)
Function used to calculate the weighted mean squared error, i.e., sum[x-avg(x)]^2 based on the given elements of the formula: meanSquaredError = sum(Wi*Xi^2) - (sum(WiXi))^2/sum(Wi)

Parameters:
weightedSq - sum(Wi*Xi^2)
weightedValue - sum(WiXi)
sum - sum of weights
Returns:
the weighted mean-squared error

entropy

protected double entropy(double[] value,
                         double sum)
Function used to calculate the entropy of given vector of values entropy = (1/sum)*{-sigma[i=1..P](Xi*log2(Xi)) + sum*log2(sum)} where P is the length of the vector

Parameters:
value - the given vector of values
sum - the sum of the given values. It's provided just for efficiency.
Returns:
the entropy