Show / Hide Table of Contents

Class LogisticRegression

Implements Logistic Regression classifier.

Inheritance
System.Object
DisposableObject
DisposableCvObject
Algorithm
StatModel
LogisticRegression
Implements
ICvPtrHolder
Inherited Members
StatModel.GetVarCount()
StatModel.Empty()
StatModel.IsTrained()
StatModel.IsClassifier()
StatModel.Train(TrainData, Int32)
StatModel.Train(InputArray, SampleTypes, InputArray)
StatModel.CalcError(TrainData, Boolean, OutputArray)
StatModel.Predict(InputArray, OutputArray, StatModel.Flags)
Algorithm.Write(FileStorage)
Algorithm.Read(FileNode)
Algorithm.Save(String)
Algorithm.GetDefaultName()
DisposableCvObject.ptr
DisposableCvObject.CvPtr
DisposableObject.DataHandle
DisposableObject.IsDisposed
DisposableObject.IsEnabledDispose
DisposableObject.AllocatedMemory
DisposableObject.AllocatedMemorySize
DisposableObject.Dispose()
DisposableObject.Dispose(Boolean)
DisposableObject.AllocGCHandle(Object)
DisposableObject.AllocMemory(Int32)
DisposableObject.NotifyMemoryPressure(Int64)
DisposableObject.ThrowIfDisposed()
Namespace: OpenCvSharp.ML
Assembly: OpenCvSharp.dll
Syntax
public class LogisticRegression : StatModel, ICvPtrHolder

Constructors

| Improve this Doc View Source

LogisticRegression(IntPtr)

Creates instance by raw pointer cv::ml::LogisticRegression*

Declaration
protected LogisticRegression(IntPtr p)
Parameters
Type Name Description
IntPtr p

Properties

| Improve this Doc View Source

Iterations

Number of iterations.

Declaration
public int Iterations { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

LearningRate

Learning rate

Declaration
public double LearningRate { get; set; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

MiniBatchSize

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.

Declaration
public int MiniBatchSize { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Regularization

Kind of regularization to be applied. See LogisticRegression::RegKinds.

Declaration
public LogisticRegression.RegKinds Regularization { get; set; }
Property Value
Type Description
LogisticRegression.RegKinds
| Improve this Doc View Source

TermCriteria

Termination criteria of the training algorithm.

Declaration
public TermCriteria TermCriteria { get; set; }
Property Value
Type Description
OpenCvSharp.TermCriteria
| Improve this Doc View Source

TrainMethod

Kind of training method used. See LogisticRegression::Methods.

Declaration
public LogisticRegression.Methods TrainMethod { get; set; }
Property Value
Type Description
LogisticRegression.Methods

Methods

| Improve this Doc View Source

Create()

Creates the empty model.

Declaration
public static LogisticRegression Create()
Returns
Type Description
LogisticRegression
| Improve this Doc View Source

DisposeManaged()

Releases managed resources

Declaration
protected override void DisposeManaged()
Overrides
DisposableObject.DisposeManaged()
| Improve this Doc View Source

DisposeUnmanaged()

Declaration
protected override void DisposeUnmanaged()
Overrides
DisposableCvObject.DisposeUnmanaged()
| Improve this Doc View Source

Get()

Declaration
public override IntPtr Get()
Returns
Type Description
IntPtr
| Improve this Doc View Source

GetLearntThetas()

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.

Declaration
public Mat GetLearntThetas()
Returns
Type Description
Mat
| Improve this Doc View Source

Load(String)

Loads and creates a serialized model from a file.

Declaration
public static LogisticRegression Load(string filePath)
Parameters
Type Name Description
System.String filePath
Returns
Type Description
LogisticRegression
| Improve this Doc View Source

LoadFromString(String)

Loads algorithm from a String.

Declaration
public static LogisticRegression LoadFromString(string strModel)
Parameters
Type Name Description
System.String strModel

he string variable containing the model you want to load.

Returns
Type Description
LogisticRegression
| Improve this Doc View Source

Predict(InputArray, OutputArray, Int32)

Predicts responses for input samples and returns a float type.

Declaration
public float Predict(InputArray samples, OutputArray results = null, int flags = 0)
Parameters
Type Name Description
InputArray 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.

OutputArray results

Predicted labels as a column matrix of type CV_32S.

System.Int32 flags

Not used.

Returns
Type Description
System.Single

Implements

ICvPtrHolder
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX