Package weka.classifiers.meta
Class RandomCommittee
- All Implemented Interfaces:
Serializable
,Cloneable
,Classifier
,BatchPredictor
,CapabilitiesHandler
,CapabilitiesIgnorer
,CommandlineRunnable
,OptionHandler
,PartitionGenerator
,Randomizable
,RevisionHandler
,WeightedInstancesHandler
public class RandomCommittee
extends RandomizableParallelIteratedSingleClassifierEnhancer
implements WeightedInstancesHandler, PartitionGenerator
Class for building an ensemble of randomizable base classifiers. Each base classifiers is built using a different random number seed (but based one the same data). The final prediction is a straight average of the predictions generated by the individual base classifiers.
Valid options are:
-S <num> Random number seed. (default 1)
-I <num> Number of iterations. (default 10)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.trees.RandomTree)
Options specific to classifier weka.classifiers.trees.RandomTree:
-K <number of attributes> Number of attributes to randomly investigate (<1 = int(log(#attributes)+1)).
-M <minimum number of instances> Set minimum number of instances per leaf.
-S <num> Seed for random number generator. (default 1)
-depth <num> The maximum depth of the tree, 0 for unlimited. (default 0)
-D If set, classifier is run in debug mode and may output additional info to the consoleOptions after -- are passed to the designated classifier.
- Version:
- $Revision: 15800 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- See Also:
-
Field Summary
Fields inherited from class weka.classifiers.AbstractClassifier
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTool tip text for this propertyvoid
buildClassifier
(Instances data) Builds the committee of randomizable classifiers.double[]
distributionForInstance
(Instance instance) Calculates the class membership probabilities for the given test instance.double[][]
Batch scoring method.void
generatePartition
(Instances data) Builds the classifier to generate a partition.Gets the preferred batch size from the base learner if it implements BatchPredictor.double[]
getMembershipValues
(Instance inst) Computes an array that indicates leaf membershipReturns the revision string.Returns a string describing classifierboolean
Returns true if the base classifier implements BatchPredictor and is able to generate batch predictions efficientlystatic void
Main method for testing this class.int
Returns the number of elements in the partition.void
setBatchSize
(String size) Set the batch size to use.toString()
Returns description of the committee.Methods inherited from class weka.classifiers.RandomizableParallelIteratedSingleClassifierEnhancer
getOptions, getSeed, listOptions, seedTipText, setOptions, setSeed
Methods inherited from class weka.classifiers.ParallelIteratedSingleClassifierEnhancer
getNumExecutionSlots, numExecutionSlotsTipText, setNumExecutionSlots
Methods inherited from class weka.classifiers.IteratedSingleClassifierEnhancer
getNumIterations, numIterationsTipText, setNumIterations
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getCapabilities, getClassifier, postExecution, preExecution, setClassifier
Methods inherited from class weka.classifiers.AbstractClassifier
classifyInstance, debugTipText, doNotCheckCapabilitiesTipText, forName, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface weka.core.CapabilitiesHandler
getCapabilities
-
Constructor Details
-
RandomCommittee
public RandomCommittee()Constructor.
-
-
Method Details
-
globalInfo
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
buildClassifier
Builds the committee of randomizable classifiers.- Specified by:
buildClassifier
in interfaceClassifier
- Overrides:
buildClassifier
in classParallelIteratedSingleClassifierEnhancer
- Parameters:
data
- the training data to be used for generating the bagged classifier.- Throws:
Exception
- if the classifier could not be built successfully
-
distributionForInstance
Calculates the class membership probabilities for the given test instance.- Specified by:
distributionForInstance
in interfaceClassifier
- Overrides:
distributionForInstance
in classAbstractClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- preedicted class probability distribution
- Throws:
Exception
- if distribution can't be computed successfully
-
batchSizeTipText
Tool tip text for this property- Overrides:
batchSizeTipText
in classAbstractClassifier
- Returns:
- the tool tip for this property
-
setBatchSize
Set the batch size to use. Gets passed through to the base learner if it implements BatchPredictor. Otherwise it is just ignored.- Specified by:
setBatchSize
in interfaceBatchPredictor
- Overrides:
setBatchSize
in classAbstractClassifier
- Parameters:
size
- the batch size to use
-
getBatchSize
Gets the preferred batch size from the base learner if it implements BatchPredictor. Returns 1 as the preferred batch size otherwise.- Specified by:
getBatchSize
in interfaceBatchPredictor
- Overrides:
getBatchSize
in classAbstractClassifier
- Returns:
- the batch size to use
-
distributionsForInstances
Batch scoring method. Calls the appropriate method for the base learner if it implements BatchPredictor. Otherwise it simply calls the distributionForInstance() method repeatedly.- Specified by:
distributionsForInstances
in interfaceBatchPredictor
- Overrides:
distributionsForInstances
in classAbstractClassifier
- Parameters:
insts
- the instances to get predictions for- Returns:
- an array of probability distributions, one for each instance
- Throws:
Exception
- if a problem occurs
-
implementsMoreEfficientBatchPrediction
public boolean implementsMoreEfficientBatchPrediction()Returns true if the base classifier implements BatchPredictor and is able to generate batch predictions efficiently- Specified by:
implementsMoreEfficientBatchPrediction
in interfaceBatchPredictor
- Overrides:
implementsMoreEfficientBatchPrediction
in classAbstractClassifier
- Returns:
- true if the base classifier can generate batch predictions efficiently
-
toString
Returns description of the committee. -
generatePartition
Builds the classifier to generate a partition.- Specified by:
generatePartition
in interfacePartitionGenerator
- Throws:
Exception
-
getMembershipValues
Computes an array that indicates leaf membership- Specified by:
getMembershipValues
in interfacePartitionGenerator
- Throws:
Exception
-
numElements
Returns the number of elements in the partition.- Specified by:
numElements
in interfacePartitionGenerator
- Throws:
Exception
-
getRevision
Returns the revision string.- Specified by:
getRevision
in interfaceRevisionHandler
- Overrides:
getRevision
in classAbstractClassifier
- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv
- the options
-