org.opencv.ml
public class CvNormalBayesClassifier extends CvStatModel
Bayes classifier for normally distributed data.
Constructor and Description |
---|
CvNormalBayesClassifier()
Default and training constructors.
|
CvNormalBayesClassifier(Mat trainData,
Mat responses)
Default and training constructors.
|
CvNormalBayesClassifier(Mat trainData,
Mat responses,
Mat varIdx,
Mat sampleIdx)
Default and training constructors.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
float |
predict(Mat samples)
Predicts the response for sample(s).
|
float |
predict(Mat samples,
Mat results)
Predicts the response for sample(s).
|
boolean |
train(Mat trainData,
Mat responses)
Trains the model.
|
boolean |
train(Mat trainData,
Mat responses,
Mat varIdx,
Mat sampleIdx,
boolean update)
Trains the model.
|
load, load, save, save
public CvNormalBayesClassifier()
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
public CvNormalBayesClassifier(Mat trainData, Mat responses)
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
trainData
- a trainDataresponses
- a responsespublic CvNormalBayesClassifier(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx)
Default and training constructors.
The constructors follow conventions of "CvStatModel.CvStatModel". See "CvStatModel.train" for parameters descriptions.
trainData
- a trainDataresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxpublic void clear()
public float predict(Mat samples)
Predicts the response for sample(s).
The method estimates the most probable classes for input vectors. Input
vectors (one or more) are stored as rows of the matrix samples
.
In case of multiple input vectors, there should be one output vector
results
. The predicted class for a single input vector is
returned by the method.
The function is parallelized with the TBB library.
samples
- a samplespublic float predict(Mat samples, Mat results)
Predicts the response for sample(s).
The method estimates the most probable classes for input vectors. Input
vectors (one or more) are stored as rows of the matrix samples
.
In case of multiple input vectors, there should be one output vector
results
. The predicted class for a single input vector is
returned by the method.
The function is parallelized with the TBB library.
samples
- a samplesresults
- a resultspublic boolean train(Mat trainData, Mat responses)
Trains the model.
The method trains the Normal Bayes classifier. It follows the conventions of the generic "CvStatModel.train" approach with the following limitations:
CV_ROW_SAMPLE
data layout is supported.
responses
must be integer numbers, though the vector may have
the CV_32FC1
type.
trainData
- a trainDataresponses
- a responsespublic boolean train(Mat trainData, Mat responses, Mat varIdx, Mat sampleIdx, boolean update)
Trains the model.
The method trains the Normal Bayes classifier. It follows the conventions of the generic "CvStatModel.train" approach with the following limitations:
CV_ROW_SAMPLE
data layout is supported.
responses
must be integer numbers, though the vector may have
the CV_32FC1
type.
trainData
- a trainDataresponses
- a responsesvarIdx
- a varIdxsampleIdx
- a sampleIdxupdate
- Identifies whether the model should be trained from scratch
(update=false
) or should be updated using the new training data
(update=true
).