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.AbstainingClassifierAutomatically 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 booleanm_CanAbstainwhether the base classifier can abstain.protected weka.filters.unsupervised.attribute.Removem_RemoveThe 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 voidbuildClassifier(weka.core.Instances data)Build the classifier on the filtered data.booleancanAbstain()Whether abstaining is possible, e.g., used in meta-classifiers.protected StringdefaultClassifierString()String describing default classifier.double[]distributionForInstance(weka.core.Instance instance)Classifies a given instance after filtering.double[][]distributionsForInstances(weka.core.Instances insts)Batch scoring methoddoublegetAbstentionClassification(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.CapabilitiesgetCapabilities()Returns default capabilities of the classifier.StringgetRevision()Returns the revision string.StringglobalInfo()Returns a string describing this classifier.booleanimplementsMoreEfficientBatchPrediction()Return true if this classifier can generate batch predictions in an efficient manner.static voidmain(String[] args)Main method for executing this classifier.StringtoString()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:
defaultClassifierStringin classweka.classifiers.SingleClassifierEnhancer- Returns:
- the default classifier classname
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Overrides:
getCapabilitiesin 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:
implementsMoreEfficientBatchPredictionin interfaceweka.core.BatchPredictor- Overrides:
implementsMoreEfficientBatchPredictionin 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 ExceptionBuild the classifier on the filtered data.- Specified by:
buildClassifierin 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 ExceptionClassifies a given instance after filtering.- Specified by:
distributionForInstancein interfaceweka.classifiers.Classifier- Overrides:
distributionForInstancein 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 ExceptionBatch scoring method- Specified by:
distributionsForInstancesin interfaceweka.core.BatchPredictor- Overrides:
distributionsForInstancesin 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:
canAbstainin interfaceweka.classifiers.AbstainingClassifier- Returns:
- true if abstaining is possible
-
getAbstentionClassification
public double getAbstentionClassification(weka.core.Instance inst) throws ExceptionThe prediction that made the classifier abstain.- Specified by:
getAbstentionClassificationin 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 ExceptionThe class distribution that made the classifier abstain.- Specified by:
getAbstentionDistributionin 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:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin 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
-
-