Package weka.classifiers.meta
Class Vote
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,CapabilitiesHandler,OptionHandler,Randomizable,RevisionHandler,TechnicalInformationHandler
public class Vote extends RandomizableMultipleClassifiersCombiner implements TechnicalInformationHandler
Class for combining classifiers. Different combinations of probability estimates for classification are available.
For more information see:
Ludmila I. Kuncheva (2004). Combining Pattern Classifiers: Methods and Algorithms. John Wiley and Sons, Inc..
J. Kittler, M. Hatef, Robert P.W. Duin, J. Matas (1998). On combining classifiers. IEEE Transactions on Pattern Analysis and Machine Intelligence. 20(3):226-239. Valid options are:-S <num> Random number seed. (default 1)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-D If set, classifier is run in debug mode and may output additional info to the console
-R <AVG|PROD|MAJ|MIN|MAX|MED> The combination rule to use (default: AVG)
BibTeX:@book{Kuncheva2004, author = {Ludmila I. Kuncheva}, publisher = {John Wiley and Sons, Inc.}, title = {Combining Pattern Classifiers: Methods and Algorithms}, year = {2004} } @article{Kittler1998, author = {J. Kittler and M. Hatef and Robert P.W. Duin and J. Matas}, journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence}, number = {3}, pages = {226-239}, title = {On combining classifiers}, volume = {20}, year = {1998} }- Version:
- $Revision: 12426 $
- Author:
- Alexander K. Seewald (alex@seewald.at), Eibe Frank (eibe@cs.waikato.ac.nz), Roberto Perdisci (roberto.perdisci@gmail.com)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static intAVERAGE_RULEcombination rule: Average of Probabilitiesstatic intMAJORITY_VOTING_RULEcombination rule: Majority Voting (only nominal classes)static intMAX_RULEcombination rule: Maximum Probabilitystatic intMEDIAN_RULEcombination rule: Median Probability (only numeric class)static intMIN_RULEcombination rule: Minimum Probabilitystatic intPRODUCT_RULEcombination rule: Product of Probabilities (only nominal classes)static Tag[]TAGS_RULEScombination rules
-
Constructor Summary
Constructors Constructor Description Vote()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildClassifier(Instances data)Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.doubleclassifyInstance(Instance instance)Classifies the given test instance.java.lang.StringcombinationRuleTipText()Returns the tip text for this propertydouble[]distributionForInstance(Instance instance)Classifies a given instance using the selected combination rule.CapabilitiesgetCapabilities()Returns default capabilities of the classifier.SelectedTaggetCombinationRule()Gets the combination rule usedjava.lang.String[]getOptions()Gets the current settings of Vote.java.lang.StringgetRevision()Returns the revision string.TechnicalInformationgetTechnicalInformation()Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.java.lang.StringglobalInfo()Returns a string describing classifierjava.util.EnumerationlistOptions()Returns an enumeration describing the available options.static voidmain(java.lang.String[] argv)Main method for testing this class.voidsetCombinationRule(SelectedTag newRule)Sets the combination rule to use.voidsetOptions(java.lang.String[] options)Parses a given list of options.java.lang.StringtoString()Output a representation of this classifier-
Methods inherited from class weka.classifiers.RandomizableMultipleClassifiersCombiner
getSeed, seedTipText, setSeed
-
Methods inherited from class weka.classifiers.MultipleClassifiersCombiner
classifiersTipText, getClassifier, getClassifiers, setClassifiers
-
Methods inherited from class weka.classifiers.Classifier
debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug
-
-
-
-
Field Detail
-
AVERAGE_RULE
public static final int AVERAGE_RULE
combination rule: Average of Probabilities- See Also:
- Constant Field Values
-
PRODUCT_RULE
public static final int PRODUCT_RULE
combination rule: Product of Probabilities (only nominal classes)- See Also:
- Constant Field Values
-
MAJORITY_VOTING_RULE
public static final int MAJORITY_VOTING_RULE
combination rule: Majority Voting (only nominal classes)- See Also:
- Constant Field Values
-
MIN_RULE
public static final int MIN_RULE
combination rule: Minimum Probability- See Also:
- Constant Field Values
-
MAX_RULE
public static final int MAX_RULE
combination rule: Maximum Probability- See Also:
- Constant Field Values
-
MEDIAN_RULE
public static final int MEDIAN_RULE
combination rule: Median Probability (only numeric class)- See Also:
- Constant Field Values
-
TAGS_RULES
public static final Tag[] TAGS_RULES
combination rules
-
-
Method Detail
-
globalInfo
public java.lang.String globalInfo()
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classRandomizableMultipleClassifiersCombiner- Returns:
- an enumeration of all the available options.
-
getOptions
public java.lang.String[] getOptions()
Gets the current settings of Vote.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classRandomizableMultipleClassifiersCombiner- Returns:
- an array of strings suitable for passing to setOptions()
-
setOptions
public void setOptions(java.lang.String[] options) throws java.lang.ExceptionParses a given list of options. Valid options are:-S <num> Random number seed. (default 1)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-D If set, classifier is run in debug mode and may output additional info to the console
-R <AVG|PROD|MAJ|MIN|MAX|MED> The combination rule to use (default: AVG)
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classRandomizableMultipleClassifiersCombiner- Parameters:
options- the list of options as an array of strings- Throws:
java.lang.Exception- if an option is not supported
-
getTechnicalInformation
public TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
getCapabilities
public Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Overrides:
getCapabilitiesin classMultipleClassifiersCombiner- Returns:
- the capabilities of this classifier
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.- Specified by:
buildClassifierin classClassifier- Parameters:
data- the training data to be used for generating the boosted classifier.- Throws:
java.lang.Exception- if the classifier could not be built successfully
-
classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
Classifies the given test instance.- Overrides:
classifyInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
- Throws:
java.lang.Exception- if an error occurred during the prediction
-
distributionForInstance
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
Classifies a given instance using the selected combination rule.- Overrides:
distributionForInstancein classClassifier- Parameters:
instance- the instance to be classified- Returns:
- the distribution
- Throws:
java.lang.Exception- if instance could not be classified successfully
-
combinationRuleTipText
public java.lang.String combinationRuleTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCombinationRule
public SelectedTag getCombinationRule()
Gets the combination rule used- Returns:
- the combination rule used
-
setCombinationRule
public void setCombinationRule(SelectedTag newRule)
Sets the combination rule to use. Values other than- Parameters:
newRule- the combination rule method to use
-
toString
public java.lang.String toString()
Output a representation of this classifier- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of the classifier
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classClassifier- Returns:
- the revision
-
main
public static void main(java.lang.String[] argv)
Main method for testing this class.- Parameters:
argv- should contain the following arguments: -t training file [-T test file] [-c class index]
-
-