Package qupath.opencv.ml
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
Wrapper class for a
StatModel
, which standardizes how training may be performed and
parameters can be set.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract TrainData
createTrainData
(Mat samples, Mat targets, Mat weights, boolean doMulticlass) Create training data in the format required by this classifier.abstract String
getName()
User-friendly, readable name for the classifierabstract 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
Apply classification, optionally requesting probability estimates.abstract boolean
Classifier can be trained interactively (i.e.abstract boolean
Classifier can handle missing (NaN) valuesabstract 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...toString()
abstract void
Train the classifier using data in an appropriate format.
-
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
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
Retrieve a list of adjustable parameter that can be used to customize the classifier. After making changes to theParameterList
, 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 weightsdoMulticlass
-- Returns:
- See Also:
-
train
Train the classifier using data in an appropriate format.- Parameters:
trainData
-- See Also:
-
predict
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 samplesresults
- a Mat to receive the resultsprobabilities
- a Mat to receive probability estimates, or null if probabilities are not needed
-
toString
-