Class AttributeAsPredictionClassifier

  • 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

    public class AttributeAsPredictionClassifier
    extends AbstractSimpleClassifier
    Simply uses the specified attribute as prediction output. Workaround for making co-variables available to Stacking.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_ActualIndex

        protected int m_ActualIndex
        the actual attribute index.
    • Constructor Detail

      • AttributeAsPredictionClassifier

        public AttributeAsPredictionClassifier()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • setAttIndex

        public void setAttIndex​(WekaAttributeIndex value)
        Sets the attribute to use for prediction.
        Parameters:
        value - the index
      • getAttIndex

        public WekaAttributeIndex getAttIndex()
        Returns the attribute to use for prediction.
        Returns:
        the index
      • attIndexTipText

        public String attIndexTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getCapabilities

        public weka.core.Capabilities getCapabilities()
        Returns the Capabilities of this classifier.
        Specified by:
        getCapabilities in interface weka.core.CapabilitiesHandler
        Specified by:
        getCapabilities in interface weka.classifiers.Classifier
        Overrides:
        getCapabilities in class AbstractSimpleClassifier
        Returns:
        the capabilities of this object
        See Also:
        Capabilities
      • buildClassifier

        public void buildClassifier​(weka.core.Instances data)
                             throws Exception
        Generates a classifier. Must initialize all fields of the classifier that are not being set via options (ie. multiple calls of buildClassifier must always lead to the same result). Must not change the dataset in any way.
        Parameters:
        data - set of instances serving as training data
        Throws:
        Exception - if the classifier has not been generated successfully
      • 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.
        Specified by:
        classifyInstance in interface weka.classifiers.Classifier
        Overrides:
        classifyInstance in class AbstractSimpleClassifier
        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
      • toString

        public String toString()
        Returns a string representation of the options.
        Overrides:
        toString in class adams.core.option.AbstractOptionHandler
        Returns:
        a string representation