Class LogisticRegression
- Namespace
- OpenCvSharp.ML
- Assembly
- OpenCvSharp.dll
Implements Logistic Regression classifier.
public class LogisticRegression : StatModel, IDisposable
- Inheritance
-
LogisticRegression
- Implements
- Inherited Members
Properties
Iterations
Number of iterations.
public int Iterations { get; set; }
Property Value
LearningRate
Learning rate
public double LearningRate { get; set; }
Property Value
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.
public int MiniBatchSize { get; set; }
Property Value
Regularization
Kind of regularization to be applied. See LogisticRegression::RegKinds.
public LogisticRegression.RegKinds Regularization { get; set; }
Property Value
TermCriteria
Termination criteria of the training algorithm.
public TermCriteria TermCriteria { get; set; }
Property Value
TrainMethod
Kind of training method used. See LogisticRegression::Methods.
public LogisticRegression.Methods TrainMethod { get; set; }
Property Value
Methods
Create()
Creates the empty model.
public static LogisticRegression Create()
Returns
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.
public Mat GetLearntThetas()
Returns
Load(string)
Loads and creates a serialized model from a file.
public static LogisticRegression Load(string filePath)
Parameters
filePathstring
Returns
LoadFromString(string)
Loads algorithm from a String.
public static LogisticRegression LoadFromString(string strModel)
Parameters
strModelstringhe string variable containing the model you want to load.
Returns
Predict(InputArray, OutputArray?, int)
Predicts responses for input samples and returns a float type.
public float Predict(InputArray samples, OutputArray? results = null, int flags = 0)
Parameters
samplesInputArrayThe 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.
resultsOutputArrayPredicted labels as a column matrix of type CV_32S.
flagsintNot used.