Package weka.classifiers.meta
Class SpectrumClassifier
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.StoppableSingleClassifierEnhancer
-
- weka.classifiers.meta.SpectrumClassifier
-
- All Implemented Interfaces:
adams.core.Stoppable
,adams.core.StoppableWithFeedback
,Serializable
,Cloneable
,weka.classifiers.AbstainingClassifier
,weka.classifiers.Classifier
,weka.core.BatchPredictor
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,weka.core.OptionHandler
,weka.core.RevisionHandler
public class SpectrumClassifier extends weka.classifiers.StoppableSingleClassifierEnhancer implements weka.classifiers.AbstainingClassifier
Automatically removes some IDs from the dataset before training the base classifier: id, db_id, sample_id.
Valid options are:
-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.functions.GPD)
Options specific to classifier weka.classifiers.functions.GPD:
-D If set, classifier is run in debug mode and may output additional info to the console
-L <double> Level of Gaussian Noise. (default: 1.0)
-G <double> Gamma for the RBF kernel. (default: 0.01)
-N Whether to 0=normalize/1=standardize/2=neither. (default: 0=normalize)
-D If set, classifier is run in debug mode and may output additional info to the console
- 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.protected weka.filters.unsupervised.attribute.Remove
m_Remove
The filter for removing sample ID/database ID.
-
Constructor Summary
Constructors Constructor Description SpectrumClassifier()
Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildClassifier(weka.core.Instances data)
Build the classifier on the filtered data.boolean
canAbstain()
Whether abstaining is possible, e.g., used in meta-classifiers.protected String
defaultClassifierString()
String describing default classifier.double[]
distributionForInstance(weka.core.Instance instance)
Classifies a given instance after filtering.double[][]
distributionsForInstances(weka.core.Instances insts)
Batch scoring methoddouble
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.weka.core.Capabilities
getCapabilities()
Returns default capabilities of the classifier.String
getRevision()
Returns the revision string.String
globalInfo()
Returns a string describing this classifier.boolean
implementsMoreEfficientBatchPrediction()
Return true if this classifier can generate batch predictions in an efficient manner.static void
main(String[] args)
Main method for executing this classifier.String
toString()
Output a representation of this classifier-
Methods inherited from class weka.classifiers.StoppableSingleClassifierEnhancer
isStopped, stopExecution
-
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, defaultClassifierOptions, getClassifier, getClassifierSpec, getOptions, listOptions, postExecution, preExecution, setClassifier, setOptions
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this classifier.- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
defaultClassifierString
protected String defaultClassifierString()
String describing default classifier.- Overrides:
defaultClassifierString
in classweka.classifiers.SingleClassifierEnhancer
- Returns:
- the default classifier classname
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilities
in interfaceweka.core.CapabilitiesHandler
- Specified by:
getCapabilities
in interfaceweka.classifiers.Classifier
- Overrides:
getCapabilities
in classweka.classifiers.SingleClassifierEnhancer
- Returns:
- the capabilities of this classifier
-
implementsMoreEfficientBatchPrediction
public boolean implementsMoreEfficientBatchPrediction()
Return true if this classifier can generate batch predictions in an efficient manner. Default implementation here returns false. Subclasses to override as appropriate.- Specified by:
implementsMoreEfficientBatchPrediction
in interfaceweka.core.BatchPredictor
- Overrides:
implementsMoreEfficientBatchPrediction
in classweka.classifiers.AbstractClassifier
- Returns:
- true if this classifier can generate batch predictions in an efficient manner.
-
buildClassifier
public void buildClassifier(weka.core.Instances data) throws Exception
Build the classifier on the filtered data.- Specified by:
buildClassifier
in interfaceweka.classifiers.Classifier
- Parameters:
data
- the training data- Throws:
Exception
- if the classifier could not be built successfully
-
distributionForInstance
public double[] distributionForInstance(weka.core.Instance instance) throws Exception
Classifies a given instance after filtering.- Specified by:
distributionForInstance
in interfaceweka.classifiers.Classifier
- Overrides:
distributionForInstance
in classweka.classifiers.AbstractClassifier
- Parameters:
instance
- the instance to be classified- Returns:
- the class distribution for the given instance
- Throws:
Exception
- if instance could not be classified successfully
-
distributionsForInstances
public double[][] distributionsForInstances(weka.core.Instances insts) throws Exception
Batch scoring method- Specified by:
distributionsForInstances
in interfaceweka.core.BatchPredictor
- Overrides:
distributionsForInstances
in classweka.classifiers.AbstractClassifier
- Parameters:
insts
- the instances to get predictions for- Returns:
- an array of probability distributions, one for each instance
- Throws:
Exception
- if a problem occurs
-
canAbstain
public boolean canAbstain()
Whether abstaining is possible, e.g., used in meta-classifiers.- Specified by:
canAbstain
in interfaceweka.classifiers.AbstainingClassifier
- 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 interfaceweka.classifiers.AbstainingClassifier
- 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 interfaceweka.classifiers.AbstainingClassifier
- 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()
Output a representation of this classifier
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.classifiers.AbstractClassifier
- Returns:
- the revision
-
main
public static void main(String[] args)
Main method for executing this classifier.- Parameters:
args
- the commandline options, use -h for help
-
-