Interface Classifier

    • Method Detail

      • buildClassifier

        void buildClassifier​(Instances data)
                      throws java.lang.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:
        java.lang.Exception - if the classifier has not been generated successfully
      • classifyInstance

        double classifyInstance​(Instance instance)
                         throws java.lang.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().
        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:
        java.lang.Exception - if an error occurred during the prediction
      • distributionForInstance

        double[] distributionForInstance​(Instance instance)
                                  throws java.lang.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().
        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:
        java.lang.Exception - if distribution could not be computed successfully
      • getCapabilities

        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.
        Returns:
        the capabilities of this object
        See Also:
        Capabilities