Package weka.classifiers.lazy
Class AbstainingLWL
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.lazy.LWL
-
- weka.classifiers.lazy.LWLSynchro
-
- weka.classifiers.lazy.AbstainingLWL
-
- All Implemented Interfaces:
Stoppable
,StoppableWithFeedback
,Serializable
,Cloneable
,AbstainingClassifier
,weka.classifiers.Classifier
,ThreadSafeClassifier
,weka.classifiers.UpdateableClassifier
,weka.core.BatchPredictor
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,weka.core.OptionHandler
,weka.core.RevisionHandler
,weka.core.TechnicalInformationHandler
,weka.core.WeightedInstancesHandler
public class AbstainingLWL extends LWLSynchro implements AbstainingClassifier
LWL variant that supports abstaining if the base classifier is able to.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_CanAbstain
whether the base classifier can abstain.-
Fields inherited from class weka.classifiers.lazy.LWLSynchro
m_NoUpdate, m_Stopped
-
-
Constructor Summary
Constructors Constructor Description AbstainingLWL()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClassifier(weka.core.Instances instances)
Generates the classifier.boolean
canAbstain()
Whether abstaining is possible, e.g., used in meta-classifiers.double
getAbstentionClassification(weka.core.Instance inst)
The prediction that made the classifier abstain.double[]
getAbstentionDistribution(weka.core.Instance inst)
The class distribution that made the classifier abstain.String
globalInfo()
Returns a string describing classifier.String
toString()
Returns a description of this classifier.-
Methods inherited from class weka.classifiers.lazy.LWLSynchro
build, defaultClassifierString, distributionForInstance, getNoUpdate, getOptions, getRevision, isStopped, listOptions, main, noUpdateTipText, setNoUpdate, setOptions, stopExecution
-
Methods inherited from class weka.classifiers.lazy.LWL
enumerateMeasures, getCapabilities, getKNN, getMeasure, getNearestNeighbourSearchAlgorithm, getTechnicalInformation, getWeightingKernel, KNNTipText, nearestNeighbourSearchAlgorithmTipText, setKNN, setNearestNeighbourSearchAlgorithm, setWeightingKernel, updateClassifier, weightingKernelTipText
-
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, defaultClassifierOptions, getClassifier, getClassifierSpec, postExecution, preExecution, setClassifier
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing classifier.- Overrides:
globalInfo
in classweka.classifiers.lazy.LWL
- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
buildClassifier
public void buildClassifier(weka.core.Instances instances) throws Exception
Generates the classifier.- Specified by:
buildClassifier
in interfaceweka.classifiers.Classifier
- Overrides:
buildClassifier
in classLWLSynchro
- Parameters:
instances
- set of instances serving as training data- Throws:
Exception
- if the classifier has not been generated successfully
-
canAbstain
public boolean canAbstain()
Whether abstaining is possible, e.g., used in meta-classifiers.- Specified by:
canAbstain
in interfaceAbstainingClassifier
- Returns:
- true if abstaining is possible
-
getAbstentionClassification
public double getAbstentionClassification(weka.core.Instance inst) throws Exception
The prediction that made the classifier abstain.- Specified by:
getAbstentionClassification
in interfaceAbstainingClassifier
- Parameters:
inst
- the instance to get the prediction for- Returns:
- the prediction,
Utils.missingValue()
if abstaining is not possible - Throws:
Exception
- if fails to make prediction
-
getAbstentionDistribution
public double[] getAbstentionDistribution(weka.core.Instance inst) throws Exception
The class distribution that made the classifier abstain.- Specified by:
getAbstentionDistribution
in interfaceAbstainingClassifier
- Parameters:
inst
- the instance to get the prediction for- Returns:
- the class distribution, null if abstaining is not possible
- Throws:
Exception
- if fails to make prediction
-
toString
public String toString()
Returns a description of this classifier.- Overrides:
toString
in classLWLSynchro
- Returns:
- a description of this classifier as a string.
-
-