OpenCV for Unity 2.6.4
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.
Loading...
Searching...
No Matches
OpenCVForUnity.MlModule.LogisticRegression Class Reference

Implements Logistic Regression classifier. More...

Public Member Functions

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

double double maxCount
 
double type
 

Static 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
 
- Static Public Attributes inherited from OpenCVForUnity.MlModule.StatModel
const int COMPRESSED_INPUT = 2
 
const int PREPROCESSED_INPUT = 4
 
const int RAW_OUTPUT = 1
 
const int UPDATE_MODEL = 1
 

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.CoreModule.Algorithm
- Protected Member Functions inherited from OpenCVForUnity.DisposableOpenCVObject
 DisposableOpenCVObject ()
 
 DisposableOpenCVObject (bool isEnabledDispose)
 
 DisposableOpenCVObject (IntPtr ptr)
 
 DisposableOpenCVObject (IntPtr ptr, bool isEnabledDispose)
 
- Protected Member Functions inherited from OpenCVForUnity.DisposableObject
 DisposableObject ()
 
 DisposableObject (bool isEnabledDispose)
 

Additional Inherited Members

- Package Functions inherited from OpenCVForUnity.MlModule.StatModel
- Package Functions inherited from OpenCVForUnity.CoreModule.Algorithm
- Package Attributes inherited from OpenCVForUnity.DisposableOpenCVObject
- 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

◆ getTermCriteriaAsValueTuple()

double double double epsilon OpenCVForUnity.MlModule.LogisticRegression.getTermCriteriaAsValueTuple ( )

◆ getTermCriteriaAsVec3d()

Vec3d OpenCVForUnity.MlModule.LogisticRegression.getTermCriteriaAsVec3d ( )
See also
setTermCriteria

◆ getTrainMethod()

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

◆ load() [1/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

◆ load() [2/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

◆ predict() [1/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.

◆ 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,
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.

◆ 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() [1/3]

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

◆ setTermCriteria() [2/3]

void OpenCVForUnity.MlModule.LogisticRegression.setTermCriteria ( in(double type, double maxCount, double epsilon) val)
See also
getTermCriteria

◆ setTermCriteria() [3/3]

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
static

◆ maxCount

double double OpenCVForUnity.MlModule.LogisticRegression.maxCount

◆ MINI_BATCH

const int OpenCVForUnity.MlModule.LogisticRegression.MINI_BATCH = 1
static

◆ REG_DISABLE

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

◆ REG_L1

const int OpenCVForUnity.MlModule.LogisticRegression.REG_L1 = 0
static

◆ REG_L2

const int OpenCVForUnity.MlModule.LogisticRegression.REG_L2 = 1
static

◆ type

double OpenCVForUnity.MlModule.LogisticRegression.type
See also
setTermCriteria

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