public class Vote extends RandomizableMultipleClassifiersCombiner implements TechnicalInformationHandler, EnvironmentHandler, Aggregateable<Classifier>
-P <path to serialized classifier> Full path to serialized classifier to include. May be specified multiple times to include multiple serialized classifiers. Note: it does not make sense to use pre-built classifiers in a cross-validation.
-R <AVG|PROD|MAJ|MIN|MAX|MED> The combination rule to use (default: AVG)
-print Print the individual models in the output
-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")
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).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}
}
| Modifier and Type | Field and Description |
|---|---|
static int |
AVERAGE_RULE
combination rule: Average of Probabilities
|
protected java.util.List<java.lang.String> |
m_classifiersToLoad
List of file paths to serialized models to load
|
protected int |
m_CombinationRule
Combination Rule variable
|
protected boolean |
m_dontPrintModels
Print the individual models in the output
|
protected Environment |
m_env
Environment variables
|
protected java.util.List<Classifier> |
m_preBuiltClassifiers
List of de-serialized pre-built classifiers to include in the ensemble
|
protected Instances |
m_structure
Structure of the training data
|
static int |
MAJORITY_VOTING_RULE
combination rule: Majority Voting (only nominal classes)
|
static int |
MAX_RULE
combination rule: Maximum Probability
|
static int |
MEDIAN_RULE
combination rule: Median Probability (only numeric class)
|
static int |
MIN_RULE
combination rule: Minimum Probability
|
static int |
PRODUCT_RULE
combination rule: Product of Probabilities (only nominal classes)
|
static Tag[] |
TAGS_RULES
combination rules
|
m_Seedm_ClassifiersBATCH_SIZE_DEFAULT, m_BatchSize, m_Debug, m_DoNotCheckCapabilities, m_numDecimalPlaces, NUM_DECIMAL_PLACES_DEFAULT| Constructor and Description |
|---|
Vote() |
| Modifier and Type | Method and Description |
|---|---|
void |
addPreBuiltClassifier(Classifier c)
Add a prebuilt classifier to the list for use in the ensemble
|
Classifier |
aggregate(Classifier toAggregate)
Aggregate an object with this one
|
void |
buildClassifier(Instances data)
Buildclassifier selects a classifier from the set of classifiers by minimising error on the
training data.
|
double |
classifyInstance(Instance instance)
Classifies the given test instance.
|
protected double |
classifyInstanceMedian(Instance instance)
Classifies the given test instance, returning the median from all classifiers.
|
java.lang.String |
combinationRuleTipText()
Returns the tip text for this property
|
double[] |
distributionForInstance(Instance instance)
Classifies a given instance using the selected combination rule.
|
protected double[] |
distributionForInstanceAverage(Instance instance)
Classifies a given instance using the Average of Probabilities combination rule.
|
protected double[] |
distributionForInstanceMajorityVoting(Instance instance)
Classifies a given instance using the Majority Voting combination rule.
|
protected double[] |
distributionForInstanceMax(Instance instance)
Classifies a given instance using the Maximum Probability combination rule.
|
protected double[] |
distributionForInstanceMin(Instance instance)
Classifies a given instance using the Minimum Probability combination rule.
|
protected double[] |
distributionForInstanceProduct(Instance instance)
Classifies a given instance using the Product of Probabilities combination rule.
|
java.lang.String |
doNotPrintModelsTipText()
Returns the tip text for this property
|
void |
finalizeAggregation()
Call to complete the aggregation process.
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
SelectedTag |
getCombinationRule()
Gets the combination rule used
|
boolean |
getDoNotPrintModels()
Get whether to print the individual ensemble models in the output
|
java.lang.String[] |
getOptions()
Gets the current settings of Vote.
|
java.io.File[] |
getPreBuiltClassifiers()
Get the paths to pre-built serialized classifiers to load and include in the ensemble
|
java.lang.String |
getRevision()
Returns the revision string.
|
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.
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
java.lang.String |
preBuiltClassifiersTipText()
Returns the tip text for this property
|
void |
removePreBuiltClassifier(Classifier c)
Remove a prebuilt classifier from the list to use in the ensemble
|
void |
setCombinationRule(SelectedTag newRule)
Sets the combination rule to use.
|
void |
setDoNotPrintModels(boolean print)
Set whether to print the individual ensemble models in the output
|
void |
setEnvironment(Environment env)
Set environment variable values to substitute in the paths of serialized models to load
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setPreBuiltClassifiers(java.io.File[] preBuilt)
Set the paths to pre-built serialized classifiers to load and include in the ensemble
|
java.lang.String |
toString()
Output a representation of this classifier
|
getSeed, seedTipText, setSeedclassifiersTipText, getClassifier, getClassifiers, getClassifierSpec, postExecution, preExecution, setClassifiersbatchSizeTipText, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlacespublic static final int AVERAGE_RULE
public static final int PRODUCT_RULE
public static final int MAJORITY_VOTING_RULE
public static final int MIN_RULE
public static final int MAX_RULE
public static final int MEDIAN_RULE
public static final Tag[] TAGS_RULES
protected int m_CombinationRule
protected java.util.List<java.lang.String> m_classifiersToLoad
protected java.util.List<Classifier> m_preBuiltClassifiers
protected transient Environment m_env
protected Instances m_structure
protected boolean m_dontPrintModels
public java.lang.String globalInfo()
public java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class RandomizableMultipleClassifiersCombinerpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class RandomizableMultipleClassifiersCombinerpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-P <path to serialized classifier> Full path to serialized classifier to include. May be specified multiple times to include multiple serialized classifiers. Note: it does not make sense to use pre-built classifiers in a cross-validation.
-R <AVG|PROD|MAJ|MIN|MAX|MED> The combination rule to use (default: AVG)
-print Print the individual models in the output
-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")
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
Options specific to classifier weka.classifiers.rules.ZeroR:
-output-debug-info If set, classifier is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, classifier capabilities are not checked before classifier is built (use with caution).
setOptions in interface OptionHandlersetOptions in class RandomizableMultipleClassifiersCombineroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic Capabilities getCapabilities()
getCapabilities in interface ClassifiergetCapabilities in interface CapabilitiesHandlergetCapabilities in class MultipleClassifiersCombinerCapabilitiespublic void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier in interface Classifierdata - the training data to be used for generating the boosted classifier.java.lang.Exception - if the classifier could not be built successfullypublic void addPreBuiltClassifier(Classifier c)
c - a prebuilt Classifier to add.public void removePreBuiltClassifier(Classifier c)
c - the classifier to removepublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance in interface ClassifierclassifyInstance in class AbstractClassifierinstance - the instance to be classifiedjava.lang.Exception - if an error occurred during the predictionprotected double classifyInstanceMedian(Instance instance) throws java.lang.Exception
instance - the instance to be classifiedjava.lang.Exception - if an error occurred during the predictionpublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance in interface ClassifierdistributionForInstance in class AbstractClassifierinstance - the instance to be classifiedjava.lang.Exception - if instance could not be classified successfullyprotected double[] distributionForInstanceAverage(Instance instance) throws java.lang.Exception
instance - the instance to be classifiedjava.lang.Exception - if instance could not be classified successfullyprotected double[] distributionForInstanceProduct(Instance instance) throws java.lang.Exception
instance - the instance to be classifiedjava.lang.Exception - if instance could not be classified successfullyprotected double[] distributionForInstanceMajorityVoting(Instance instance) throws java.lang.Exception
instance - the instance to be classifiedjava.lang.Exception - if instance could not be classified successfullyprotected double[] distributionForInstanceMax(Instance instance) throws java.lang.Exception
instance - the instance to be classifiedjava.lang.Exception - if instance could not be classified successfullyprotected double[] distributionForInstanceMin(Instance instance) throws java.lang.Exception
instance - the instance to be classifiedjava.lang.Exception - if instance could not be classified successfullypublic java.lang.String combinationRuleTipText()
public SelectedTag getCombinationRule()
public void setCombinationRule(SelectedTag newRule)
newRule - the combination rule method to usepublic java.lang.String preBuiltClassifiersTipText()
public void setPreBuiltClassifiers(java.io.File[] preBuilt)
preBuilt - an array of File paths to serialized modelspublic java.io.File[] getPreBuiltClassifiers()
public java.lang.String doNotPrintModelsTipText()
public void setDoNotPrintModels(boolean print)
print - true if the individual models are to be printedpublic boolean getDoNotPrintModels()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class AbstractClassifierpublic void setEnvironment(Environment env)
setEnvironment in interface EnvironmentHandlerenv - the environment variables to usepublic Classifier aggregate(Classifier toAggregate) throws java.lang.Exception
aggregate in interface Aggregateable<Classifier>toAggregate - the object to aggregatejava.lang.Exception - if the supplied object can't be aggregated for some reasonpublic void finalizeAggregation()
throws java.lang.Exception
finalizeAggregation in interface Aggregateable<Classifier>java.lang.Exception - if the aggregation can't be finalized for some reasonpublic static void main(java.lang.String[] argv)
argv - should contain the following arguments: -t training file [-T test file] [-c class index]