Package se.hb.jcp.ml

Class ClassifierBase

    • Constructor Summary

      Constructors 
      Constructor Description
      ClassifierBase()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void fit​(cern.colt.matrix.DoubleMatrix2D x, double[] y)
      Trains this classifier using the supplied data.
      int getAttributeCount()
      Returns the number of attributes the classifier has been trained on.
      java.lang.Double[] getLabels()
      Returns the set of class labels the classifier has been trained on.
      protected abstract void internalFit​(cern.colt.matrix.DoubleMatrix2D x, double[] y)  
      boolean isTrained()
      Returns whether this classifier has been trained.
      • Methods inherited from class java.lang.Object

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

      • ClassifierBase

        public ClassifierBase()
    • Method Detail

      • fit

        public final void fit​(cern.colt.matrix.DoubleMatrix2D x,
                              double[] y)
        Description copied from interface: IClassifier
        Trains this classifier using the supplied data.
        Specified by:
        fit in interface IClassifier
        Parameters:
        x - the attributes of the instances.
        y - the targets of the instances.
      • isTrained

        public final boolean isTrained()
        Description copied from interface: IClassifierInformation
        Returns whether this classifier has been trained.
        Specified by:
        isTrained in interface IClassifierInformation
        Returns:
        Returns true if the classifier has been trained or false otherwise.
      • getAttributeCount

        public final int getAttributeCount()
        Description copied from interface: IClassifierInformation
        Returns the number of attributes the classifier has been trained on.
        Specified by:
        getAttributeCount in interface IClassifierInformation
        Returns:
        Returns the number of attributes the classifier has been trained on or -1 if the classifier has not been trained.
      • getLabels

        public final java.lang.Double[] getLabels()
        Description copied from interface: IClassifierInformation
        Returns the set of class labels the classifier has been trained on.
        Specified by:
        getLabels in interface IClassifierInformation
        Returns:
        Returns the class labels the classifier has been trained on in increasing order (the index is the class id) or null if the classifier has not been trained.
      • internalFit

        protected abstract void internalFit​(cern.colt.matrix.DoubleMatrix2D x,
                                            double[] y)