mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
Updated Normal Bayes Classifier docs
This commit is contained in:
@@ -13,53 +13,44 @@ CvNormalBayesClassifier
|
||||
-----------------------
|
||||
.. ocv:class:: CvNormalBayesClassifier
|
||||
|
||||
Bayes classifier for normally distributed data. ::
|
||||
Bayes classifier for normally distributed data.
|
||||
|
||||
class CvNormalBayesClassifier : public CvStatModel
|
||||
{
|
||||
public:
|
||||
CvNormalBayesClassifier();
|
||||
virtual ~CvNormalBayesClassifier();
|
||||
CvNormalBayesClassifier::CvNormalBayesClassifier
|
||||
------------------------------------------------
|
||||
Default and training constructors.
|
||||
|
||||
CvNormalBayesClassifier( const Mat& _train_data, const Mat& _responses,
|
||||
const Mat& _var_idx=Mat(), const Mat& _sample_idx=Mat() );
|
||||
.. ocv:function:: CvNormalBayesClassifier::CvNormalBayesClassifier()
|
||||
|
||||
virtual bool train( const Mat& _train_data, const Mat& _responses,
|
||||
const Mat& _var_idx=Mat(), const Mat& _sample_idx=Mat(), bool update=false );
|
||||
.. ocv:function:: CvNormalBayesClassifier::CvNormalBayesClassifier( const Mat& trainData, const Mat& responses, const Mat& varIdx=Mat(), const Mat& sampleIdx=Mat() )
|
||||
|
||||
virtual float predict( const Mat& _samples, Mat* results=0 ) const;
|
||||
virtual void clear();
|
||||
|
||||
virtual void save( const char* filename, const char* name=0 );
|
||||
virtual void load( const char* filename, const char* name=0 );
|
||||
|
||||
virtual void write( CvFileStorage* storage, const char* name );
|
||||
virtual void read( CvFileStorage* storage, CvFileNode* node );
|
||||
protected:
|
||||
...
|
||||
};
|
||||
.. ocv:cfunction:: CvNormalBayesClassifier::CvNormalBayesClassifier( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx=0, const CvMat* sampleIdx=0 )
|
||||
|
||||
The constructors follow conventions of :ocv:func:`CvStatModel::CvStatModel`. See :ocv:func:`CvStatModel::train` for parameters descriptions.
|
||||
|
||||
CvNormalBayesClassifier::train
|
||||
------------------------------
|
||||
Trains the model.
|
||||
|
||||
.. ocv:function:: bool CvNormalBayesClassifier::train( const Mat& _train_data, const Mat& _responses, const Mat& _var_idx =Mat(), const Mat& _sample_idx=Mat(), bool update=false )
|
||||
.. ocv:function:: bool CvNormalBayesClassifier::train( const Mat& trainData, const Mat& responses, const Mat& varIdx = Mat(), const Mat& sampleIdx=Mat(), bool update=false )
|
||||
|
||||
The method trains the Normal Bayes classifier. It follows the conventions of the generic ``train`` approach with the following limitations:
|
||||
.. ocv:cfunction:: bool CvNormalBayesClassifier::train( const CvMat* trainData, const CvMat* responses, const CvMat* varIdx = 0, const CvMat* sampleIdx=0, bool update=false )
|
||||
|
||||
:param update: Identifies whether the model should be trained from scratch (``update=false``) or should be updated using the new training data (``update=true``).
|
||||
|
||||
The method trains the Normal Bayes classifier. It follows the conventions of the generic :ocv:func:`CvStatModel::train` approach with the following limitations:
|
||||
|
||||
* Only ``CV_ROW_SAMPLE`` data layout is supported.
|
||||
* Input variables are all ordered.
|
||||
* Output variable is categorical , which means that elements of ``_responses`` must be integer numbers, though the vector may have the ``CV_32FC1`` type.
|
||||
* Output variable is categorical , which means that elements of ``responses`` must be integer numbers, though the vector may have the ``CV_32FC1`` type.
|
||||
* Missing measurements are not supported.
|
||||
|
||||
In addition, there is an ``update`` flag that identifies whether the model should be trained from scratch ( ``update=false`` ) or should be updated using the new training data ( ``update=true`` ).
|
||||
|
||||
CvNormalBayesClassifier::predict
|
||||
--------------------------------
|
||||
Predicts the response for sample(s).
|
||||
|
||||
.. ocv:function:: float CvNormalBayesClassifier::predict( const Mat& samples, Mat* results=0 ) const
|
||||
|
||||
The method ``predict`` 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.
|
||||
.. ocv:cfunction:: float CvNormalBayesClassifier::predict( const CvMat* samples, CvMat* results=0 ) const
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user