OpenCV
3.3.0
Open Source Computer Vision
|
Implements Logistic Regression classifier. More...
#include "ml.hpp"
Public Types | |
enum | Methods { BATCH = 0, MINI_BATCH = 1 } |
Training methods. More... | |
enum | RegKinds { REG_DISABLE = -1, REG_L1 = 0, REG_L2 = 1 } |
Regularization kinds. More... | |
Public Types inherited from cv::ml::StatModel | |
enum | Flags { UPDATE_MODEL = 1, RAW_OUTPUT =1, COMPRESSED_INPUT =2, PREPROCESSED_INPUT =4 } |
Public Member Functions | |
virtual Mat | get_learnt_thetas () const =0 |
This function returns the trained paramters arranged across rows. More... | |
virtual int | getIterations () const =0 |
virtual double | getLearningRate () const =0 |
virtual int | getMiniBatchSize () const =0 |
virtual int | getRegularization () const =0 |
virtual TermCriteria | getTermCriteria () const =0 |
virtual int | getTrainMethod () const =0 |
virtual float | predict (InputArray samples, OutputArray results=noArray(), int flags=0) const =0 |
Predicts responses for input samples and returns a float type. More... | |
virtual void | setIterations (int val)=0 |
virtual void | setLearningRate (double val)=0 |
virtual void | setMiniBatchSize (int val)=0 |
virtual void | setRegularization (int val)=0 |
virtual void | setTermCriteria (TermCriteria val)=0 |
virtual void | setTrainMethod (int val)=0 |
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. More... | |
virtual bool | empty () const |
Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More... | |
virtual int | getVarCount () const =0 |
Returns the number of variables in training samples. More... | |
virtual bool | isClassifier () const =0 |
Returns true if the model is classifier. More... | |
virtual bool | isTrained () const =0 |
Returns true if the model is trained. More... | |
virtual bool | train (const Ptr< TrainData > &trainData, int flags=0) |
Trains the statistical model. More... | |
virtual bool | train (InputArray samples, int layout, InputArray responses) |
Trains the statistical model. More... | |
Public Member Functions inherited from cv::Algorithm | |
Algorithm () | |
virtual | ~Algorithm () |
virtual void | clear () |
Clears the algorithm state. More... | |
virtual String | getDefaultName () const |
virtual void | read (const FileNode &fn) |
Reads algorithm parameters from a file storage. More... | |
virtual void | save (const String &filename) const |
virtual void | write (FileStorage &fs) const |
Stores algorithm parameters in a file storage. More... | |
Static Public Member Functions | |
static Ptr< LogisticRegression > | create () |
Creates empty model. More... | |
static Ptr< LogisticRegression > | load (const String &filepath, const String &nodeName=String()) |
Loads and creates a serialized LogisticRegression from a file. More... | |
Static Public Member Functions inherited from cv::ml::StatModel | |
template<typename _Tp > | |
static Ptr< _Tp > | train (const Ptr< TrainData > &data, int flags=0) |
Create and train model with default parameters. More... | |
Static Public Member Functions inherited from cv::Algorithm | |
template<typename _Tp > | |
static Ptr< _Tp > | load (const String &filename, const String &objname=String()) |
Loads algorithm from the file. More... | |
template<typename _Tp > | |
static Ptr< _Tp > | loadFromString (const String &strModel, const String &objname=String()) |
Loads algorithm from a String. More... | |
template<typename _Tp > | |
static Ptr< _Tp > | read (const FileNode &fn) |
Reads algorithm from the file node. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from cv::Algorithm | |
void | writeFormat (FileStorage &fs) const |
Implements Logistic Regression classifier.
|
static |
Creates empty model.
Creates Logistic Regression model with parameters given.
|
pure virtual |
This function returns the trained paramters arranged across rows.
For a two class classifcation problem, it returns a row matrix. It returns learnt paramters of the Logistic Regression as a matrix of type CV_32F.
|
pure virtual |
Number of iterations.
|
pure virtual |
Learning rate.
|
pure virtual |
Specifies the number of training samples taken in each step of Mini-Batch Gradient Descent. Will only be used if using LogisticRegression::MINI_BATCH training algorithm. It has to take values less than the total number of training samples.
|
pure virtual |
Kind of regularization to be applied. See LogisticRegression::RegKinds.
|
pure virtual |
Termination criteria of the algorithm.
|
pure virtual |
Kind of training method used. See LogisticRegression::Methods.
|
static |
Loads and creates a serialized LogisticRegression from a file.
Use LogisticRegression::save to serialize and store an LogisticRegression to disk. Load the LogisticRegression from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier
filepath | path to serialized LogisticRegression |
nodeName | name of node containing the classifier |
|
pure virtual |
Predicts responses for input samples and returns a float type.
samples | The input data for the prediction algorithm. Matrix [m x n], where each row contains variables (features) of one object being classified. Should have data type CV_32F. |
results | Predicted labels as a column matrix of type CV_32S. |
flags | Not used. |
Implements cv::ml::StatModel.
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
pure virtual |