Class SVMClassifier

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected libsvm.svm_model _model  
      protected libsvm.svm_parameter _parameters  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double distanceFromSeparatingPlane​(cern.colt.matrix.DoubleMatrix1D instance)
      Returns the signed distance between the separating hyperplane and the instance.
      IClassifier fitNew​(cern.colt.matrix.DoubleMatrix2D x, double[] y)
      Trains and returns a copy of this classifier using the supplied data.
      protected void internalFit​(cern.colt.matrix.DoubleMatrix2D x, double[] y)  
      cern.colt.matrix.DoubleMatrix1D nativeStorageTemplate()
      Returns a value of the DoubleMatrix1D derived class that is the native storage format for the classifier.
      double predict​(cern.colt.matrix.DoubleMatrix1D instance)
      Predicts the target for the supplied instance.
      double predict​(cern.colt.matrix.DoubleMatrix1D instance, double[] probabilityEstimates)
      Predicts the target probabilities for the supplied instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _parameters

        protected libsvm.svm_parameter _parameters
      • _model

        protected libsvm.svm_model _model
    • Constructor Detail

      • SVMClassifier

        public SVMClassifier()
      • SVMClassifier

        public SVMClassifier​(org.json.JSONObject parameters)
      • SVMClassifier

        public SVMClassifier​(libsvm.svm_parameter parameters)
    • Method Detail

      • internalFit

        protected void internalFit​(cern.colt.matrix.DoubleMatrix2D x,
                                   double[] y)
        Specified by:
        internalFit in class ClassifierBase
      • fitNew

        public IClassifier fitNew​(cern.colt.matrix.DoubleMatrix2D x,
                                  double[] y)
        Description copied from interface: IClassifier
        Trains and returns a copy of this classifier using the supplied data.
        Specified by:
        fitNew in interface IClassifier
        Parameters:
        x - the attributes of the instances.
        y - the targets of the instances.
        Returns:
        a new IClassifier instance trained with the supplied data and using the same algorithm and parameter settings as the parent instance.
      • predict

        public double predict​(cern.colt.matrix.DoubleMatrix1D instance)
        Description copied from interface: IClassifier
        Predicts the target for the supplied instance.
        Specified by:
        predict in interface IClassifier
        Parameters:
        instance - the instance
        Returns:
        the predicted target of the instance.
      • predict

        public double predict​(cern.colt.matrix.DoubleMatrix1D instance,
                              double[] probabilityEstimates)
        Description copied from interface: IClassProbabilityClassifier
        Predicts the target probabilities for the supplied instance.
        Specified by:
        predict in interface IClassProbabilityClassifier
        Parameters:
        instance - the instance
        probabilityEstimates - a double[] array for storing the predicted probabilities for each of target values in the order assumed by JCP.
        Returns:
        the predicted target of the instance.
      • distanceFromSeparatingPlane

        public double distanceFromSeparatingPlane​(cern.colt.matrix.DoubleMatrix1D instance)
        Returns the signed distance between the separating hyperplane and the instance.
        Specified by:
        distanceFromSeparatingPlane in interface ISVMClassifier
        Parameters:
        instance - the instance.
        Returns:
        the signed distance between the separating hyperplane and the instance.
      • nativeStorageTemplate

        public cern.colt.matrix.DoubleMatrix1D nativeStorageTemplate()
        Description copied from interface: IClassifierInformation
        Returns a value of the DoubleMatrix1D derived class that is the native storage format for the classifier.
        Specified by:
        nativeStorageTemplate in interface IClassifierInformation
        Returns:
        a value of the DoubleMatrix1D derived class of the native storage format for the classifier.