Class AbstractClassifier<T>

java.lang.Object
smile.classification.AbstractClassifier<T>
Type Parameters:
T - the type of input object
All Implemented Interfaces:
Serializable, ToDoubleFunction<T>, ToIntFunction<T>, Classifier<T>
Direct Known Subclasses:
AdaBoost, DiscreteNaiveBayes, FLD, GradientTreeBoost, KNN, LDA, LogisticRegression, Maxent, NaiveBayes, OneVersusOne, OneVersusRest, QDA, RandomForest, RBFNetwork, SparseLogisticRegression

public abstract class AbstractClassifier<T> extends Object implements Classifier<T>
Abstract base class of classifiers.
See Also:
  • Field Details

    • classes

      protected final IntSet classes
      The class labels.
  • Constructor Details

    • AbstractClassifier

      public AbstractClassifier(IntSet classes)
      Constructor.
      Parameters:
      classes - the class labels.
    • AbstractClassifier

      public AbstractClassifier(int[] y)
      Constructor.
      Parameters:
      y - the sample labels.
    • AbstractClassifier

      public AbstractClassifier(BaseVector<?,?,?> y)
      Constructor.
      Parameters:
      y - the sample labels.
  • Method Details

    • numClasses

      public int numClasses()
      Description copied from interface: Classifier
      Returns the number of classes.
      Specified by:
      numClasses in interface Classifier<T>
      Returns:
      the number of classes.
    • classes

      public int[] classes()
      Description copied from interface: Classifier
      Returns the class labels.
      Specified by:
      classes in interface Classifier<T>
      Returns:
      the class labels.