Package weka.classifiers.simple
Class AbstractSimpleClassifier
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- weka.core.AbstractSimpleOptionHandler
-
- weka.classifiers.simple.AbstractSimpleClassifier
-
- All Implemented Interfaces:
adams.core.Destroyable,adams.core.GlobalInfoSupporter,adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.option.OptionHandler,adams.core.SizeOfHandler,Serializable,weka.classifiers.Classifier,weka.core.CapabilitiesHandler,weka.core.OptionHandler
- Direct Known Subclasses:
DJLRegressor,FromPredictions,JepRegressor,XGBoost
public abstract class AbstractSimpleClassifier extends AbstractSimpleOptionHandler implements weka.classifiers.Classifier, weka.core.CapabilitiesHandler
Ancestor for classifiers using ADAMS option handling.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractSimpleClassifier()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleclassifyInstance(weka.core.Instance instance)Classifies the given test instance.double[]distributionForInstance(weka.core.Instance instance)Predicts the class memberships for a given instance.weka.core.CapabilitiesgetCapabilities()Returns the Capabilities of this classifier.static voidrunClassifier(weka.classifiers.Classifier classifier, String[] options)runs the classifier instance with the given options.-
Methods inherited from class weka.core.AbstractSimpleOptionHandler
getOptions, listOptions, setOptions
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Method Detail
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws ExceptionClassifies the given test instance. The instance has to belong to a dataset when it's being classified. Note that a classifier MUST implement either this or distributionForInstance().- Specified by:
classifyInstancein interfaceweka.classifiers.Classifier- 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. Note that a classifier MUST implement either this or classifyInstance().- Specified by:
distributionForInstancein interfaceweka.classifiers.Classifier- 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
-
runClassifier
public static void runClassifier(weka.classifiers.Classifier classifier, String[] options)runs the classifier instance with the given options.- Parameters:
classifier- the classifier to runoptions- the commandline options
-
getCapabilities
public weka.core.Capabilities getCapabilities()
Returns the Capabilities of this classifier. Maximally permissive capabilities are allowed by default. Derived classifiers should override this method and first disable all capabilities and then enable just those capabilities that make sense for the scheme.- Specified by:
getCapabilitiesin interfaceweka.core.CapabilitiesHandler- Specified by:
getCapabilitiesin interfaceweka.classifiers.Classifier- Returns:
- the capabilities of this object
- See Also:
Capabilities
-
-