|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.SingleClassifierEnhancer
weka.classifiers.RandomizableSingleClassifierEnhancer
weka.classifiers.meta.SubsetEnsemble
public class SubsetEnsemble
Generates an ensemble using the following approach:
- for each attribute apart from class attribute do:
* create new dataset with only this feature and the class attribute
* remove all instances that contain a missing value
* if no instances left in subset, don't build a classifier for this feature
* if at least 1 instance is left in subset, build base classifier with it
If no classifier gets built at all, use ZeroR as backup model, built on the full dataset.
In addition to the default feature for a subset, a number of random features can be added to the subset before the classifier is trained.
At prediction time, the Vote meta-classifier (using the pre-built classifiers) is used to determing the class probabilities or regression value.
-num-slots <num> Number of execution slots. (default: 1 - i.e. no parallelism)
-combination-rule <AVG|PROD|MAJ|MIN|MAX|MED> The combination rule to use (default: AVG)
-num-random <num> Number of random features to use in addition. (default: 0)
-S <num> Random number seed. (default 1)
-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.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the consoleOptions after -- are passed to the designated classifier.
| Field Summary | |
|---|---|
protected weka.classifiers.rules.ZeroR |
m_BackupModel
The backup classifier, in case no ensemble could be constructed at prediction time. |
protected weka.classifiers.Classifier[] |
m_Classifiers
the actual classifiers in use. |
protected int |
m_CombinationRule
Combination Rule variable. |
protected int |
m_Completed
The number of classifiers completed so far |
protected weka.core.Instances |
m_Data
For holding the original training set temporarily. |
protected ThreadPoolExecutor |
m_ExecutorPool
Pool of threads to train models with |
protected int |
m_Failed
The number of classifiers that experienced a failure of some sort during construction. |
protected weka.core.Instances |
m_Header
The header of the training set. |
protected int |
m_NumExecutionSlots
The number of threads to have executing at any one time |
protected int |
m_NumRandomFeatures
the number of random features to use (in addition to base attribute). |
| Fields inherited from class weka.classifiers.RandomizableSingleClassifierEnhancer |
|---|
m_Seed |
| Fields inherited from class weka.classifiers.SingleClassifierEnhancer |
|---|
m_Classifier |
| Fields inherited from class weka.classifiers.AbstractClassifier |
|---|
m_Debug |
| Constructor Summary | |
|---|---|
SubsetEnsemble()
|
|
| Method Summary | |
|---|---|
void |
buildClassifier(weka.core.Instances data)
Stump method for building the classifiers |
protected void |
buildClassifiers()
Does the actual construction of the ensemble. |
double |
classifyInstance(weka.core.Instance instance)
Classifies the given test instance. |
String |
combinationRuleTipText()
Returns the tip text for this property. |
protected void |
completedClassifier(int index,
boolean success)
Records the completion of the training of a single classifier. |
protected weka.classifiers.Classifier |
constructEnsemble(weka.core.Instance instance)
Constructs the ensemble. |
double[] |
distributionForInstance(weka.core.Instance instance)
Predicts the class memberships for a given instance. |
protected int |
getActualIndex(int index)
Returns the actual index in the data of the feature attribute. |
weka.core.SelectedTag |
getCombinationRule()
Gets the combination rule used |
protected weka.filters.Filter |
getFilter(int index,
int seed,
boolean withMissing)
Gets a filter for a particular index. |
int |
getNumExecutionSlots()
Get the number of execution slots (threads) to use for building the members of the ensemble. |
int |
getNumRandomFeatures()
Returns the number of additional random features to use. |
String[] |
getOptions()
Gets the current settings of the classifier. |
String |
getRevision()
Returns the revision string. |
protected weka.core.Instances |
getTrainingSet(int index,
int seed)
Gets a training set for a particular index. |
String |
globalInfo()
Returns a string describing the classifier. |
Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(String[] args)
Main method for running this class from commandline. |
String |
numExecutionSlotsTipText()
Returns the tip text for this property. |
String |
numRandomFeaturesTipText()
Returns the tip text for this property. |
void |
setCombinationRule(weka.core.SelectedTag value)
Sets the combination rule to use. |
void |
setNumExecutionSlots(int value)
Set the number of execution slots (threads) to use for building the members of the ensemble. |
void |
setNumRandomFeatures(int value)
Set the number of additional random features to use. |
void |
setOptions(String[] options)
Parses a given list of options. |
protected void |
startExecutorPool()
Start the pool of execution threads. |
String |
toString()
Returns a string representation of the classifier. |
| Methods inherited from class weka.classifiers.RandomizableSingleClassifierEnhancer |
|---|
getSeed, seedTipText, setSeed |
| Methods inherited from class weka.classifiers.SingleClassifierEnhancer |
|---|
classifierTipText, defaultClassifierString, getCapabilities, getClassifier, getClassifierSpec, setClassifier |
| Methods inherited from class weka.classifiers.AbstractClassifier |
|---|
debugTipText, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected weka.classifiers.Classifier[] m_Classifiers
protected int m_NumExecutionSlots
protected int m_CombinationRule
protected int m_NumRandomFeatures
protected transient ThreadPoolExecutor m_ExecutorPool
protected int m_Completed
protected int m_Failed
protected weka.core.Instances m_Data
protected weka.core.Instances m_Header
protected weka.classifiers.rules.ZeroR m_BackupModel
| Constructor Detail |
|---|
public SubsetEnsemble()
| Method Detail |
|---|
public String globalInfo()
public Enumeration listOptions()
listOptions in interface weka.core.OptionHandlerlistOptions in class weka.classifiers.RandomizableSingleClassifierEnhancer
public void setOptions(String[] options)
throws Exception
-num-slots <num> Number of execution slots. (default: 1 - i.e. no parallelism)
-combination-rule <AVG|PROD|MAJ|MIN|MAX|MED> The combination rule to use (default: AVG)
-num-random <num> Number of random features to use in addition. (default: 0)
-S <num> Random number seed. (default 1)
-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.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the consoleOptions after -- are passed to the designated classifier.
setOptions in interface weka.core.OptionHandlersetOptions in class weka.classifiers.RandomizableSingleClassifierEnhanceroptions - the list of options as an array of strings
Exception - if an option is not supportedpublic String[] getOptions()
getOptions in interface weka.core.OptionHandlergetOptions in class weka.classifiers.RandomizableSingleClassifierEnhancerpublic void setNumExecutionSlots(int value)
value - the number of slots to use.public int getNumExecutionSlots()
public String numExecutionSlotsTipText()
public void setCombinationRule(weka.core.SelectedTag value)
value - the combination rule method to usepublic weka.core.SelectedTag getCombinationRule()
public String combinationRuleTipText()
public void setNumRandomFeatures(int value)
value - the number of random featurespublic int getNumRandomFeatures()
public String numRandomFeaturesTipText()
protected void startExecutorPool()
protected void buildClassifiers()
throws Exception
Exception - if something goes wrong during the training process
protected void completedClassifier(int index,
boolean success)
index - the index of the classifier that has completedsuccess - whether the classifier trained successfully
protected int getActualIndex(int index)
throws Exception
index - the index for the requested attribute
Exception - if something goes wrong
protected weka.filters.Filter getFilter(int index,
int seed,
boolean withMissing)
throws Exception
index - the index for the requested filterseed - the seed value to use for the determining the additional
random featureswithMissing - whether to include the RemoveInstancesWithMissingValue filter
Exception - if something goes wrong
protected weka.core.Instances getTrainingSet(int index,
int seed)
throws Exception
index - the index for the requested training setseed - the seed value to use for the determining the additional
random features
Exception - if something goes wrong
public void buildClassifier(weka.core.Instances data)
throws Exception
data - the training data to be used for generating the ensemble
Exception - if the classifier could not be built successfullyprotected weka.classifiers.Classifier constructEnsemble(weka.core.Instance instance)
instance - the instance to base the construction on
public double classifyInstance(weka.core.Instance instance)
throws Exception
classifyInstance in interface weka.classifiers.ClassifierclassifyInstance in class weka.classifiers.AbstractClassifierinstance - the instance to be classified
Exception - if an error occurred during the prediction
public double[] distributionForInstance(weka.core.Instance instance)
throws Exception
distributionForInstance in interface weka.classifiers.ClassifierdistributionForInstance in class weka.classifiers.AbstractClassifierinstance - the instance to be classified
Exception - if distribution could not be computed successfullypublic String toString()
toString in class Objectpublic String getRevision()
getRevision in interface weka.core.RevisionHandlergetRevision in class weka.classifiers.AbstractClassifierpublic static void main(String[] args)
args - the options
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||