OpenCV  4.10.0-dev
Open Source Computer Vision
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
cv::ml::NormalBayesClassifier Class Referenceabstract

Bayes classifier for normally distributed data. More...

#include <opencv2/ml.hpp>

Collaboration diagram for cv::ml::NormalBayesClassifier:

Public Member Functions

virtual float predictProb (InputArray inputs, OutputArray outputs, OutputArray outputProbs, int flags=0) const =0
 Predicts the response for sample(s).
 
- Public Member Functions inherited from cv::ml::StatModel
virtual float calcError (const Ptr< TrainData > &data, bool test, OutputArray resp) const
 Computes error on the training or test dataset.
 
virtual bool empty () const CV_OVERRIDE
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read.
 
virtual int getVarCount () const =0
 Returns the number of variables in training samples.
 
virtual bool isClassifier () const =0
 Returns true if the model is classifier.
 
virtual bool isTrained () const =0
 Returns true if the model is trained.
 
virtual float predict (InputArray samples, OutputArray results=noArray(), int flags=0) const =0
 Predicts response(s) for the provided sample(s)
 
virtual bool train (const Ptr< TrainData > &trainData, int flags=0)
 Trains the statistical model.
 
virtual bool train (InputArray samples, int layout, InputArray responses)
 Trains the statistical model.
 
- Public Member Functions inherited from cv::Algorithm
 Algorithm ()
 
virtual ~Algorithm ()
 
virtual void clear ()
 Clears the algorithm state.
 
virtual String getDefaultName () const
 
virtual void read (const FileNode &fn)
 Reads algorithm parameters from a file storage.
 
virtual void save (const String &filename) const
 
void write (const Ptr< FileStorage > &fs, const String &name=String()) const
 
virtual void write (FileStorage &fs) const
 Stores algorithm parameters in a file storage.
 
void write (FileStorage &fs, const String &name) const
 

Static Public Member Functions

static Ptr< NormalBayesClassifiercreate ()
 
static Ptr< NormalBayesClassifierload (const String &filepath, const String &nodeName=String())
 Loads and creates a serialized NormalBayesClassifier from a file.
 
- Static Public Member Functions inherited from cv::ml::StatModel
template<typename _Tp >
static Ptr< _Tptrain (const Ptr< TrainData > &data, int flags=0)
 Create and train model with default parameters.
 
- Static Public Member Functions inherited from cv::Algorithm
template<typename _Tp >
static Ptr< _Tpload (const String &filename, const String &objname=String())
 Loads algorithm from the file.
 
template<typename _Tp >
static Ptr< _TploadFromString (const String &strModel, const String &objname=String())
 Loads algorithm from a String.
 
template<typename _Tp >
static Ptr< _Tpread (const FileNode &fn)
 Reads algorithm from the file node.
 

Additional Inherited Members

- Public Types inherited from cv::ml::StatModel
enum  Flags {
  UPDATE_MODEL = 1 ,
  RAW_OUTPUT =1 ,
  COMPRESSED_INPUT =2 ,
  PREPROCESSED_INPUT =4
}
 
- Protected Member Functions inherited from cv::Algorithm
void writeFormat (FileStorage &fs) const
 

Detailed Description

Bayes classifier for normally distributed data.

See also
Normal Bayes Classifier

Member Function Documentation

◆ create()

static Ptr< NormalBayesClassifier > cv::ml::NormalBayesClassifier::create ( )
static
Python:
cv.ml.NormalBayesClassifier.create() -> retval
cv.ml.NormalBayesClassifier_create() -> retval

Creates empty model Use StatModel::train to train the model after creation.

◆ load()

static Ptr< NormalBayesClassifier > cv::ml::NormalBayesClassifier::load ( const String filepath,
const String nodeName = String() 
)
static
Python:
cv.ml.NormalBayesClassifier.load(filepath[, nodeName]) -> retval
cv.ml.NormalBayesClassifier_load(filepath[, nodeName]) -> retval

Loads and creates a serialized NormalBayesClassifier from a file.

Use NormalBayesClassifier::save to serialize and store an NormalBayesClassifier to disk. Load the NormalBayesClassifier from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

Parameters
filepathpath to serialized NormalBayesClassifier
nodeNamename of node containing the classifier

◆ predictProb()

virtual float cv::ml::NormalBayesClassifier::predictProb ( InputArray  inputs,
OutputArray  outputs,
OutputArray  outputProbs,
int  flags = 0 
) const
pure virtual
Python:
cv.ml.NormalBayesClassifier.predictProb(inputs[, outputs[, outputProbs[, flags]]]) -> retval, outputs, outputProbs

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 inputs. In case of multiple input vectors, there should be one output vector outputs. The predicted class for a single input vector is returned by the method. The vector outputProbs contains the output probabilities corresponding to each element of result.


The documentation for this class was generated from the following file: