|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.rules.ConjunctiveRule
This class implements a single conjunctive rule learner that can predict for numeric and nominal class labels.
A rule consists of antecedents "AND"ed together and the consequent (class value)
for the classification/regression. In this case, the consequent is the
distribution of the available classes (or numeric value) in the dataset.
If the test instance is not covered by this rule, then it's predicted
using the default class distributions/value of the data not covered by the
rule in the training data.
This learner selects an antecedent by computing the Information Gain of each
antecendent and prunes the generated rule using Reduced Error Prunning (REP).
For classification, the Information of one antecedent is the weighted average of
the entropies of both the data covered and not covered by the rule.
For regression, the Information is the weighted average of the mean-squared errors
of both the data covered and not covered by the rule.
In pruning, weighted average of accuracy rate of the pruning data is used for classification while the weighted average of the mean-squared errors of the pruning data is used for regression.
Constructor Summary | |
ConjunctiveRule()
|
Method Summary | |
void |
buildClassifier(Instances instances)
Builds a single rule learner with REP dealing with nominal classes or numeric classes. |
double[] |
distributionForInstance(Instance instance)
Computes class distribution for the given instance. |
java.lang.String |
exclusiveTipText()
Returns the tip text for this property |
java.lang.String |
foldsTipText()
Returns the tip text for this property |
boolean |
getExclusive()
|
int |
getFolds()
|
double |
getMinNo()
|
int |
getNumAntds()
|
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
long |
getSeed()
|
java.lang.String |
globalInfo()
Returns a string describing classifier |
boolean |
hasAntds()
Whether this rule has antecedents, i.e. |
boolean |
isCover(Instance datum)
Whether the instance covered by this rule |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options Valid options are: |
static void |
main(java.lang.String[] args)
Main method. |
java.lang.String |
minNoTipText()
Returns the tip text for this property |
java.lang.String |
numAntdsTipText()
Returns the tip text for this property |
java.lang.String |
seedTipText()
Returns the tip text for this property |
void |
setExclusive(boolean e)
|
void |
setFolds(int folds)
|
void |
setMinNo(double m)
|
void |
setNumAntds(int n)
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setSeed(long s)
|
java.lang.String |
toString()
Prints this rule |
java.lang.String |
toString(java.lang.String att,
java.lang.String cl)
Prints this rule with the specified class label |
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConjunctiveRule()
Method Detail |
public java.lang.String globalInfo()
public java.util.Enumeration listOptions()
-N number
Set number of folds for REP. One fold is
used as the pruning set. (Default: 3)
-R
Set if NOT randomize the data before split to growing and
pruning data. If NOT set, the seed of randomization is
specified by the -S option. (Default: randomize)
-S
Seed of randomization. (Default: 1)
-E
Set whether consider the exclusive expressions for nominal
attribute split. (Default: false)
-M number
Set the minimal weights of instances within a split.
(Default: 2)
-P number
Set the number of antecedents allowed in the rule if pre-pruning
is used. If this value is other than -1, then pre-pruning will be
used, otherwise the rule uses REP. (Default: -1)
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String foldsTipText()
public void setFolds(int folds)
public int getFolds()
public java.lang.String seedTipText()
public void setSeed(long s)
public long getSeed()
public java.lang.String exclusiveTipText()
public boolean getExclusive()
public void setExclusive(boolean e)
public java.lang.String minNoTipText()
public void setMinNo(double m)
public double getMinNo()
public java.lang.String numAntdsTipText()
public void setNumAntds(int n)
public int getNumAntds()
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- the training data
java.lang.Exception
- if classifier can't be built successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance for which distribution is to be computed
java.lang.Exception
- if distribution could not be
computed successfullypublic boolean isCover(Instance datum)
public boolean hasAntds()
public java.lang.String toString(java.lang.String att, java.lang.String cl)
att
- the string standing for attribute in the consequent of this rulecl
- the string standing for value in the consequent of this rule
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- the options for the classifier
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London