Package qupath.opencv.ml
Class OpenCVClassifiers.DTreesClassifier
java.lang.Object
qupath.opencv.ml.OpenCVClassifiers.OpenCVStatModel
qupath.opencv.ml.OpenCVClassifiers.DTreesClassifier
- Enclosing class:
- OpenCVClassifiers
Classifier based on 
DTrees.- 
Method SummaryModifier and TypeMethodDescriptioncreateTrainData(Mat samples, Mat targets, Mat weights, boolean doMulticlass) Create training data in the format required by this classifier.getName()User-friendly, readable name for the classifierRetrieve a list of adjustable parameter that can be used to customize the classifier.protected intbooleanClassifier has already been trained and is ready to predict.voidDefault implementation callingprotected voidpredictWithLock(Mat samples, Mat results, Mat probabilities) Implement predictWithLock rather than predict to ensure predict is not called while training.booleanReturns true (the default value).booleanTree classifiers in OpenCV support missing values, others do not.booleanReturns false (the default value).booleanClassifier can output a prediction confidence (expressed between 0 and 1), so may be interpreted as a probability...toString()voidTrain the classifier using data in an appropriate format.voidtrainWithLock(TrainData trainData) Implement trainWithLock rather than train directly to ensure a lock is set when training, which can be used to prevent prediction occurring simultaneously.
- 
Method Details- 
supportsMulticlasspublic boolean supportsMulticlass()Returns false (the default value).- Specified by:
- supportsMulticlassin class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- true if multiclass classification is supported, false otherwise
 
- 
supportsAutoUpdatepublic boolean supportsAutoUpdate()Returns true (the default value).- Specified by:
- supportsAutoUpdatein class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- true if interactive classification is supported, false otherwise
 
- 
supportsProbabilitiespublic boolean supportsProbabilities()Description copied from class:OpenCVClassifiers.OpenCVStatModelClassifier can output a prediction confidence (expressed between 0 and 1), so may be interpreted as a probability... even if it isn't necessarily one.- Specified by:
- supportsProbabilitiesin class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- true if (pseudo-)probabilities can be provided
 
- 
isTrainedpublic boolean isTrained()Description copied from class:OpenCVClassifiers.OpenCVStatModelClassifier has already been trained and is ready to predict.- Specified by:
- isTrainedin class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- true if the classifier is trained, false otherwise
 
- 
getParameterListDescription copied from class:OpenCVClassifiers.OpenCVStatModelRetrieve 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.- Specified by:
- getParameterListin class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- the parameter list for this classifier
 
- 
toString- Overrides:
- toStringin class- OpenCVClassifiers.OpenCVStatModel
 
- 
createTrainDataDescription copied from class:OpenCVClassifiers.OpenCVStatModelCreate training data in the format required by this classifier.- Specified by:
- createTrainDatain class- OpenCVClassifiers.OpenCVStatModel
- Parameters:
- samples-
- targets-
- weights- optional weights
- doMulticlass-
- Returns:
- See Also:
 
- 
trainDescription copied from class:OpenCVClassifiers.OpenCVStatModelTrain the classifier using data in an appropriate format.- Specified by:
- trainin class- OpenCVClassifiers.OpenCVStatModel
- Parameters:
- trainData-
- See Also:
 
- 
trainWithLockImplement trainWithLock rather than train directly to ensure a lock is set when training, which can be used to prevent prediction occurring simultaneously.- Parameters:
- trainData-
- See Also:
 
- 
getTrainFlagsprotected int getTrainFlags()
- 
getNameDescription copied from class:OpenCVClassifiers.OpenCVStatModelUser-friendly, readable name for the classifier- Specified by:
- getNamein class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- the classifier name
 
- 
predictDefault implementation callingstatModel.predict(samples, results, 0); before attempting to sanitize the outcome so that results always contains a signed int Mat containing classifications.If results originally had more than 1 column, it will be returned as probabilities (if probabilities is not null); probabilitieswill be an empty matrix (i.e. no probabilities calculated).- Specified by:
- predictin class- OpenCVClassifiers.OpenCVStatModel
- 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
 
- 
predictWithLockImplement predictWithLock rather than predict to ensure predict is not called while training.- Parameters:
- samples-
- results-
- probabilities-
- See Also:
 
- 
supportsMissingValuespublic boolean supportsMissingValues()Tree classifiers in OpenCV support missing values, others do not.- Specified by:
- supportsMissingValuesin class- OpenCVClassifiers.OpenCVStatModel
- Returns:
- true if NaNs are supported, false otherwise
 
 
-