Class OpenCVClassifiers.OpenCVStatModel

java.lang.Object
qupath.opencv.ml.OpenCVClassifiers.OpenCVStatModel
Direct Known Subclasses:
OpenCVClassifiers.BoostClassifier, OpenCVClassifiers.DTreesClassifier, OpenCVClassifiers.EMClusterer, OpenCVClassifiers.LogisticRegressionClassifier, OpenCVClassifiers.NormalBayesClassifierCV, OpenCVClassifiers.RTreesClassifier, OpenCVClassifiers.SVMClassifierCV, OpenCVClassifiers.SVMSGDClassifierCV
Enclosing class:
OpenCVClassifiers

public abstract static class OpenCVClassifiers.OpenCVStatModel extends Object
Wrapper class for a StatModel, which standardizes how training may be performed and parameters can be set.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract TrainData
    createTrainData(Mat samples, Mat targets, Mat weights, boolean doMulticlass)
    Create training data in the format required by this classifier.
    abstract String
    User-friendly, readable name for the classifier
    abstract ParameterList
    Retrieve a list of adjustable parameter that can be used to customize the classifier.
    abstract boolean
    Classifier has already been trained and is ready to predict.
    abstract void
    predict(Mat samples, Mat results, Mat probabilities)
    Apply classification, optionally requesting probability estimates.
    abstract boolean
    Classifier can be trained interactively (i.e.
    abstract boolean
    Classifier can handle missing (NaN) values
    abstract boolean
    Classifier is able to handle more than one outputs for a single sample.
    abstract boolean
    Classifier can output a prediction confidence (expressed between 0 and 1), so may be interpreted as a probability...
     
    abstract void
    train(TrainData trainData)
    Train the classifier using data in an appropriate format.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • OpenCVStatModel

      public OpenCVStatModel()
  • Method Details

    • supportsMissingValues

      public abstract boolean supportsMissingValues()
      Classifier can handle missing (NaN) values
      Returns:
      true if NaNs are supported, false otherwise
    • getName

      public abstract String getName()
      User-friendly, readable name for the classifier
      Returns:
      the classifier name
    • isTrained

      public abstract boolean isTrained()
      Classifier has already been trained and is ready to predict.
      Returns:
      true if the classifier is trained, false otherwise
    • supportsMulticlass

      public abstract boolean supportsMulticlass()
      Classifier is able to handle more than one outputs for a single sample.
      Returns:
      true if multiclass classification is supported, false otherwise
    • supportsAutoUpdate

      public abstract boolean supportsAutoUpdate()
      Classifier can be trained interactively (i.e. quickly).
      Returns:
      true if interactive classification is supported, false otherwise
    • supportsProbabilities

      public abstract boolean supportsProbabilities()
      Classifier can output a prediction confidence (expressed between 0 and 1), so may be interpreted as a probability... even if it isn't necessarily one.
      Returns:
      true if (pseudo-)probabilities can be provided
    • getParameterList

      public abstract ParameterList getParameterList()
      Retrieve a list of adjustable parameter that can be used to customize the classifier. After making changes to the ParameterList, the classifier should be retrained before being used.
      Returns:
      the parameter list for this classifier
    • createTrainData

      public abstract TrainData createTrainData(Mat samples, Mat targets, Mat weights, boolean doMulticlass)
      Create training data in the format required by this classifier.
      Parameters:
      samples -
      targets -
      weights - optional weights
      doMulticlass -
      Returns:
      See Also:
    • train

      public abstract void train(TrainData trainData)
      Train the classifier using data in an appropriate format.
      Parameters:
      trainData -
      See Also:
    • predict

      public abstract void predict(Mat samples, Mat results, Mat probabilities)
      Apply classification, optionally requesting probability estimates.

      Not all StatModels are capable of estimating probability values, in which case probabilities will be null (if not supplied) or an empty matrix.

      Note also that if probabilities are required, these will not necessarily be normalized between 0 and 1 (although they generally are). They represent a best-effort for the StatModel to provide confidence values, but are not (necessarily) strictly probabilities.

      For example, RTrees estimates probabilities based on the proportion of votes for the 'winning' classification.

      Parameters:
      samples - the input samples
      results - a Mat to receive the results
      probabilities - a Mat to receive probability estimates, or null if probabilities are not needed
    • toString

      public String toString()
      Overrides:
      toString in class Object