OpenCV for Unity  2.6.3
Enox Software / Please refer to OpenCV official document ( http://docs.opencv.org/4.10.0/index.html ) for the details of the argument of the method.
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
OpenCVForUnity.MlModule.LogisticRegression Class Reference

Implements Logistic Regression classifier. More...

Inheritance diagram for OpenCVForUnity.MlModule.LogisticRegression:
OpenCVForUnity.MlModule.StatModel OpenCVForUnity.CoreModule.Algorithm OpenCVForUnity.DisposableOpenCVObject OpenCVForUnity.DisposableObject

Public Member Functions

double getLearningRate ()
 
void setLearningRate (double val)
 
int getIterations ()
 
void setIterations (int val)
 
int getRegularization ()
 
void setRegularization (int val)
 
int getTrainMethod ()
 
void setTrainMethod (int val)
 
int getMiniBatchSize ()
 
void setMiniBatchSize (int val)
 
TermCriteria getTermCriteria ()
 
void setTermCriteria (TermCriteria val)
 
override float predict (Mat samples, Mat results, int flags)
 Predicts responses for input samples and returns a float type. More...
 
override float predict (Mat samples, Mat results)
 Predicts responses for input samples and returns a float type. More...
 
override float predict (Mat samples)
 Predicts responses for input samples and returns a float type. More...
 
Mat get_learnt_thetas ()
 This function returns the trained parameters arranged across rows. More...
 
- Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel
int getVarCount ()
 Returns the number of variables in training samples. More...
 
override bool empty ()
 Returns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read. More...
 
bool isTrained ()
 Returns true if the model is trained. More...
 
bool isClassifier ()
 Returns true if the model is classifier. More...
 
bool train (TrainData trainData, int flags)
 Trains the statistical model. More...
 
bool train (TrainData trainData)
 Trains the statistical model. More...
 
bool train (Mat samples, int layout, Mat responses)
 Trains the statistical model. More...
 
float calcError (TrainData data, bool test, Mat resp)
 Computes error on the training or test dataset. More...
 
- Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
IntPtr getNativeObjAddr ()
 
virtual void clear ()
 Clears the algorithm state. More...
 
void save (string filename)
 
virtual string getDefaultName ()
 
- Public Member Functions inherited from OpenCVForUnity.DisposableObject
void Dispose ()
 
void ThrowIfDisposed ()
 

Static Public Member Functions

static new LogisticRegression __fromPtr__ (IntPtr addr)
 
static LogisticRegression create ()
 Creates empty model. More...
 
static LogisticRegression load (string filepath, string nodeName)
 Loads and creates a serialized LogisticRegression from a file. More...
 
static LogisticRegression load (string filepath)
 Loads and creates a serialized LogisticRegression from a file. More...
 
- Static Public Member Functions inherited from OpenCVForUnity.MlModule.StatModel
static new StatModel __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.CoreModule.Algorithm
static Algorithm __fromPtr__ (IntPtr addr)
 
- Static Public Member Functions inherited from OpenCVForUnity.DisposableObject
static IntPtr ThrowIfNullIntPtr (IntPtr ptr)
 

Public Attributes

const int BATCH = 0
 
const int MINI_BATCH = 1
 
const int REG_DISABLE = -1
 
const int REG_L1 = 0
 
const int REG_L2 = 1
 
- Public Attributes inherited from OpenCVForUnity.MlModule.StatModel
const int UPDATE_MODEL = 1
 
const int RAW_OUTPUT = 1
 
const int COMPRESSED_INPUT = 2
 
const int PREPROCESSED_INPUT = 4
 

Protected Member Functions

override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.MlModule.StatModel
override void Dispose (bool disposing)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Properties inherited from OpenCVForUnity.DisposableObject
bool IsDisposed [get, protected set]
 
bool IsEnabledDispose [get, set]
 

Detailed Description

Implements Logistic Regression classifier.

See also
ml_intro_lr

Member Function Documentation

◆ __fromPtr__()

static new LogisticRegression OpenCVForUnity.MlModule.LogisticRegression.__fromPtr__ ( IntPtr  addr)
static

◆ create()

static LogisticRegression OpenCVForUnity.MlModule.LogisticRegression.create ( )
static

Creates empty model.

Creates Logistic Regression model with parameters given.

◆ Dispose()

override void OpenCVForUnity.MlModule.LogisticRegression.Dispose ( bool  disposing)
protectedvirtual

◆ get_learnt_thetas()

Mat OpenCVForUnity.MlModule.LogisticRegression.get_learnt_thetas ( )

This function returns the trained parameters arranged across rows.

For a two class classification problem, it returns a row matrix. It returns learnt parameters of the Logistic Regression as a matrix of type CV_32F.

◆ getIterations()

int OpenCVForUnity.MlModule.LogisticRegression.getIterations ( )
See also
setIterations

◆ getLearningRate()

double OpenCVForUnity.MlModule.LogisticRegression.getLearningRate ( )
See also
setLearningRate

◆ getMiniBatchSize()

int OpenCVForUnity.MlModule.LogisticRegression.getMiniBatchSize ( )

◆ getRegularization()

int OpenCVForUnity.MlModule.LogisticRegression.getRegularization ( )

◆ getTermCriteria()

TermCriteria OpenCVForUnity.MlModule.LogisticRegression.getTermCriteria ( )
See also
setTermCriteria

◆ getTrainMethod()

int OpenCVForUnity.MlModule.LogisticRegression.getTrainMethod ( )
See also
setTrainMethod

◆ load() [1/2]

static LogisticRegression OpenCVForUnity.MlModule.LogisticRegression.load ( string  filepath,
string  nodeName 
)
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

Parameters
filepathpath to serialized LogisticRegression
nodeNamename of node containing the classifier

◆ load() [2/2]

static LogisticRegression OpenCVForUnity.MlModule.LogisticRegression.load ( string  filepath)
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

Parameters
filepathpath to serialized LogisticRegression
nodeNamename of node containing the classifier

◆ predict() [1/3]

override float OpenCVForUnity.MlModule.LogisticRegression.predict ( Mat  samples,
Mat  results,
int  flags 
)
virtual

Predicts responses for input samples and returns a float type.

Parameters
samplesThe 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.
resultsPredicted labels as a column matrix of type CV_32S.
flagsNot used.

Reimplemented from OpenCVForUnity.MlModule.StatModel.

◆ predict() [2/3]

override float OpenCVForUnity.MlModule.LogisticRegression.predict ( Mat  samples,
Mat  results 
)
virtual

Predicts responses for input samples and returns a float type.

Parameters
samplesThe 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.
resultsPredicted labels as a column matrix of type CV_32S.
flagsNot used.

Reimplemented from OpenCVForUnity.MlModule.StatModel.

◆ predict() [3/3]

override float OpenCVForUnity.MlModule.LogisticRegression.predict ( Mat  samples)
virtual

Predicts responses for input samples and returns a float type.

Parameters
samplesThe 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.
resultsPredicted labels as a column matrix of type CV_32S.
flagsNot used.

Reimplemented from OpenCVForUnity.MlModule.StatModel.

◆ setIterations()

void OpenCVForUnity.MlModule.LogisticRegression.setIterations ( int  val)
See also
getIterations

◆ setLearningRate()

void OpenCVForUnity.MlModule.LogisticRegression.setLearningRate ( double  val)
See also
getLearningRate

◆ setMiniBatchSize()

void OpenCVForUnity.MlModule.LogisticRegression.setMiniBatchSize ( int  val)

◆ setRegularization()

void OpenCVForUnity.MlModule.LogisticRegression.setRegularization ( int  val)

◆ setTermCriteria()

void OpenCVForUnity.MlModule.LogisticRegression.setTermCriteria ( TermCriteria  val)
See also
getTermCriteria

◆ setTrainMethod()

void OpenCVForUnity.MlModule.LogisticRegression.setTrainMethod ( int  val)
See also
getTrainMethod

Member Data Documentation

◆ BATCH

const int OpenCVForUnity.MlModule.LogisticRegression.BATCH = 0

◆ MINI_BATCH

const int OpenCVForUnity.MlModule.LogisticRegression.MINI_BATCH = 1

◆ REG_DISABLE

const int OpenCVForUnity.MlModule.LogisticRegression.REG_DISABLE = -1

◆ REG_L1

const int OpenCVForUnity.MlModule.LogisticRegression.REG_L1 = 0

◆ REG_L2

const int OpenCVForUnity.MlModule.LogisticRegression.REG_L2 = 1

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