Package weka.classifiers.meta
Class Fallback
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.meta.Fallback
-
- All Implemented Interfaces:
Serializable,Cloneable,weka.classifiers.Classifier,weka.core.BatchPredictor,weka.core.CapabilitiesHandler,weka.core.CapabilitiesIgnorer,weka.core.CommandlineRunnable,weka.core.OptionHandler,weka.core.RevisionHandler
public class Fallback extends weka.classifiers.AbstractClassifierIn case the base classifier fails to make predictions, uses fallback one.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected weka.classifiers.Classifierm_ActualBasethe actual base classifier.protected weka.classifiers.Classifierm_ActualFallbackthe actual fallback classifier.protected weka.classifiers.Classifierm_Basethe base classifier.protected weka.classifiers.Classifierm_Fallbackthe fallback classifier.
-
Constructor Summary
Constructors Constructor Description Fallback()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringbaseTipText()Returns the tip text for this property.voidbuildClassifier(weka.core.Instances data)Generates a classifier.doubleclassifyInstance(weka.core.Instance instance)Classifies the given test instance.double[]distributionForInstance(weka.core.Instance instance)Predicts the class memberships for a given instance.StringfallbackTipText()Returns the tip text for this property.weka.classifiers.ClassifiergetBase()Returns the base classifier.weka.core.CapabilitiesgetCapabilities()Returns the Capabilities of this classifier.protected weka.classifiers.ClassifiergetDefaultBase()Returns the default base classifier.protected weka.classifiers.ClassifiergetDefaultFallback()Returns the default fallback classifier.weka.classifiers.ClassifiergetFallback()Returns the fallback classifier.String[]getOptions()Gets the current option settings for the OptionHandler.StringglobalInfo()Returns a string describing classifier.EnumerationlistOptions()Returns an enumeration describing the available options.voidsetBase(weka.classifiers.Classifier value)Sets the base classifier.voidsetFallback(weka.classifiers.Classifier value)Sets the fallback classifier.voidsetOptions(String[] options)Sets the OptionHandler's options using the given list.StringtoString()Returns a description of the model.-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, getRevision, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Field Detail
-
m_Base
protected weka.classifiers.Classifier m_Base
the base classifier.
-
m_ActualBase
protected weka.classifiers.Classifier m_ActualBase
the actual base classifier.
-
m_Fallback
protected weka.classifiers.Classifier m_Fallback
the fallback classifier.
-
m_ActualFallback
protected weka.classifiers.Classifier m_ActualFallback
the actual fallback classifier.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing classifier.- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration listOptions()
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.classifiers.AbstractClassifier- Returns:
- an enumeration of all the available options.
-
setOptions
public void setOptions(String[] options) throws Exception
Sets the OptionHandler's options using the given list.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin classweka.classifiers.AbstractClassifier- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
public String[] getOptions()
Gets the current option settings for the OptionHandler.- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.classifiers.AbstractClassifier- Returns:
- the list of current option settings as an array of strings
-
getDefaultBase
protected weka.classifiers.Classifier getDefaultBase()
Returns the default base classifier.- Returns:
- the default
-
setBase
public void setBase(weka.classifiers.Classifier value)
Sets the base classifier.- Parameters:
value- the base
-
getBase
public weka.classifiers.Classifier getBase()
Returns the base classifier.- Returns:
- the base
-
baseTipText
public String baseTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDefaultFallback
protected weka.classifiers.Classifier getDefaultFallback()
Returns the default fallback classifier.- Returns:
- the default
-
setFallback
public void setFallback(weka.classifiers.Classifier value)
Sets the fallback classifier.- Parameters:
value- the fallback
-
getFallback
public weka.classifiers.Classifier getFallback()
Returns the fallback classifier.- Returns:
- the fallback
-
fallbackTipText
public String fallbackTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this classifier.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin classweka.classifiers.AbstractClassifier- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws ExceptionGenerates a classifier.- Parameters:
data- set of instances serving as training data- Throws:
Exception- if the classifier has not been generated successfully
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws ExceptionClassifies the given test instance.- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- Overrides:
classifyInstancein classweka.classifiers.AbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted most likely class for the instance or Utils.missingValue() if no prediction is made
- Throws:
Exception- if an error occurred during the prediction
-
distributionForInstance
public double[] distributionForInstance(weka.core.Instance instance) throws ExceptionPredicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero. If the class is numeric, the array must consist of only one element, which contains the predicted value.- Specified by:
distributionForInstancein interfaceweka.classifiers.Classifier- Overrides:
distributionForInstancein classweka.classifiers.AbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
- Throws:
Exception- if distribution could not be computed successfully
-
-