Class 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:
    FromPredictions, PyroProxy, 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
    • Field Summary

      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double classifyInstance​(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.Capabilities getCapabilities()
      Returns the Capabilities of this classifier.
      static void runClassifier​(weka.classifiers.Classifier classifier, String[] options)
      runs the classifier instance with the given options.
      • 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
      • Methods inherited from interface weka.classifiers.Classifier

        buildClassifier
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
    • Constructor Detail

      • AbstractSimpleClassifier

        public AbstractSimpleClassifier()
    • Method Detail

      • classifyInstance

        public double classifyInstance​(weka.core.Instance instance)
                                throws Exception
        Classifies 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:
        classifyInstance in interface weka.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 Exception
        Predicts 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:
        distributionForInstance in interface weka.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 run
        options - 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:
        getCapabilities in interface weka.core.CapabilitiesHandler
        Specified by:
        getCapabilities in interface weka.classifiers.Classifier
        Returns:
        the capabilities of this object
        See Also:
        Capabilities