类 ConjunctiveRule
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.rules.ConjunctiveRule
- 所有已实现的接口:
Serializable
,Cloneable
,CapabilitiesHandler
,OptionHandler
,RevisionHandler
,WeightedInstancesHandler
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 mean for a 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) or simple pre-pruning based on the number of antecedents.
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 the accuracy rates on the pruning data is used for classification while the weighted average of the mean-squared errors on the pruning data is used for regression.
Valid options are:
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 mean for a 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) or simple pre-pruning based on the number of antecedents.
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 the accuracy rates on the pruning data is used for classification while the weighted average of the mean-squared errors on the pruning data is used for regression.
Valid options are:
-N <number of folds> Set number of folds for REP One fold is used as pruning set. (default 3)
-R Set if NOT uses randomization (default:use randomization)
-E Set whether consider the exclusive expressions for nominal attributes (default false)
-M <min. weights> Set the minimal weights of instances within a split. (default 2.0)
-P <number of antecedents> Set number of antecedents for pre-pruning if -1, then REP is used (default -1)
-S <seed> Set the seed of randomization (default 1)
- 版本:
- $Revision: 9835 $
- 作者:
- Xin XU (xx5@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明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.Returns the tip text for this propertyReturns the tip text for this propertyReturns default capabilities of the classifier.boolean
Returns whether exclusive expressions for nominal attributes splits are consideredint
getFolds()
returns the current number of foldsdouble
getMinNo()
Gets the minimum total weight of the instances in a ruleint
Gets the number of antecedantsString[]
Gets the current settings of the Classifier.Returns the revision string.long
getSeed()
returns the current seed value for randomizing the dataReturns a string describing classifierboolean
hasAntds()
Whether this rule has antecedents, i.e.boolean
Whether the instance covered by this ruleReturns an enumeration describing the available options Valid options are:static void
Main method.Returns the tip text for this propertyReturns the tip text for this propertyReturns the tip text for this propertyvoid
setExclusive
(boolean e) Sets whether exclusive expressions for nominal attributes splits are consideredvoid
setFolds
(int folds) the number of folds to usevoid
setMinNo
(double m) Sets the minimum total weight of the instances in a rulevoid
setNumAntds
(int n) Sets the number of antecedantsvoid
setOptions
(String[] options) Parses a given list of options.void
setSeed
(long s) sets the seed for randomizing the datatoString()
Prints this rulePrints this rule with the specified class label从类继承的方法 weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
构造器详细资料
-
ConjunctiveRule
public ConjunctiveRule()
-
-
方法详细资料
-
globalInfo
Returns a string describing classifier- 返回:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options Valid options are:-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
在接口中OptionHandler
- 覆盖:
listOptions
在类中Classifier
- 返回:
- an enumeration of all the available options
-
setOptions
Parses a given list of options. Valid options are:-N <number of folds> Set number of folds for REP One fold is used as pruning set. (default 3)
-R Set if NOT uses randomization (default:use randomization)
-E Set whether consider the exclusive expressions for nominal attributes (default false)
-M <min. weights> Set the minimal weights of instances within a split. (default 2.0)
-P <number of antecedents> Set number of antecedents for pre-pruning if -1, then REP is used (default -1)
-S <seed> Set the seed of randomization (default 1)
- 指定者:
setOptions
在接口中OptionHandler
- 覆盖:
setOptions
在类中Classifier
- 参数:
options
- the list of options as an array of strings- 抛出:
Exception
- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- 指定者:
getOptions
在接口中OptionHandler
- 覆盖:
getOptions
在类中Classifier
- 返回:
- an array of strings suitable for passing to setOptions
-
foldsTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setFolds
public void setFolds(int folds) the number of folds to use- 参数:
folds
- the number of folds to use
-
getFolds
public int getFolds()returns the current number of folds- 返回:
- the number of folds
-
seedTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(long s) sets the seed for randomizing the data- 参数:
s
- the seed value
-
getSeed
public long getSeed()returns the current seed value for randomizing the data- 返回:
- the seed value
-
exclusiveTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getExclusive
public boolean getExclusive()Returns whether exclusive expressions for nominal attributes splits are considered- 返回:
- true if exclusive expressions for nominal attributes splits are considered
-
setExclusive
public void setExclusive(boolean e) Sets whether exclusive expressions for nominal attributes splits are considered- 参数:
e
- whether to consider exclusive expressions for nominal attribute splits
-
minNoTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setMinNo
public void setMinNo(double m) Sets the minimum total weight of the instances in a rule- 参数:
m
- the minimum total weight of the instances in a rule
-
getMinNo
public double getMinNo()Gets the minimum total weight of the instances in a rule- 返回:
- the minimum total weight of the instances in a rule
-
numAntdsTipText
Returns the tip text for this property- 返回:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setNumAntds
public void setNumAntds(int n) Sets the number of antecedants- 参数:
n
- the number of antecedants
-
getNumAntds
public int getNumAntds()Gets the number of antecedants- 返回:
- the number of antecedants
-
getCapabilities
Returns default capabilities of the classifier.- 指定者:
getCapabilities
在接口中CapabilitiesHandler
- 覆盖:
getCapabilities
在类中Classifier
- 返回:
- the capabilities of this classifier
- 另请参阅:
-
buildClassifier
Builds a single rule learner with REP dealing with nominal classes or numeric classes. For nominal classes, this rule learner predicts a distribution on the classes. For numeric classes, this learner predicts a single value.- 指定者:
buildClassifier
在类中Classifier
- 参数:
instances
- the training data- 抛出:
Exception
- if classifier can't be built successfully
-
distributionForInstance
Computes class distribution for the given instance.- 覆盖:
distributionForInstance
在类中Classifier
- 参数:
instance
- the instance for which distribution is to be computed- 返回:
- the class distribution for the given instance
- 抛出:
Exception
- if given instance is null
-
isCover
Whether the instance covered by this rule- 参数:
datum
- the instance in question- 返回:
- the boolean value indicating whether the instance is covered by this rule
-
hasAntds
public boolean hasAntds()Whether this rule has antecedents, i.e. whether it is a default rule- 返回:
- the boolean value indicating whether the rule has antecedents
-
toString
Prints this rule with the specified class label- 参数:
att
- the string standing for attribute in the consequent of this rulecl
- the string standing for value in the consequent of this rule- 返回:
- a textual description of this rule with the specified class label
-
toString
Prints this rule -
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 覆盖:
getRevision
在类中Classifier
- 返回:
- the revision
-
main
Main method.- 参数:
args
- the options for the classifier
-