ml_LogisticRegression
import { ml_LogisticRegression } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods. Inherits ml_StatModel.
Logistic Regression *
***************************************************************************************
Implements Logistic Regression classifier.
See: ml_intro_lr
Constructors and members
static create
Creates empty model.
Creates Logistic Regression model with parameters given.
create(): ml_LogisticRegression | null;The ml_LogisticRegression | null result.
static load
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
load(filepath: EmbindString, nodeName: EmbindString): ml_LogisticRegression | null;2 available overloads
load(filepath: EmbindString): ml_LogisticRegression | null;load(filepath: EmbindString, nodeName: EmbindString): ml_LogisticRegression | null;filepathpath to serialized LogisticRegression
nodeNamename of node containing the classifier
The ml_LogisticRegression | null result.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
getLearningRate
Learning rate. See: setLearningRate
getLearningRate(): number;The number result.
setLearningRate
Learning rate. See: setLearningRate See: getLearningRate
setLearningRate(val: number): void;valval argument (number).
getIterations
Number of iterations. See: setIterations
getIterations(): number;The number result.
setIterations
Number of iterations. See: setIterations See: getIterations
setIterations(val: number): void;valval argument (number).
getRegularization
Kind of regularization to be applied. See LogisticRegression::RegKinds. See: setRegularization
getRegularization(): number;The number result.
setRegularization
Kind of regularization to be applied. See LogisticRegression::RegKinds. See: setRegularization See: getRegularization
setRegularization(val: number): void;valval argument (number).
getTrainMethod
Kind of training method used. See LogisticRegression::Methods. See: setTrainMethod
getTrainMethod(): number;The number result.
setTrainMethod
Kind of training method used. See LogisticRegression::Methods. See: setTrainMethod See: getTrainMethod
setTrainMethod(val: number): void;valval argument (number).
getMiniBatchSize
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. See: setMiniBatchSize
getMiniBatchSize(): number;The number result.
setMiniBatchSize
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. See: setMiniBatchSize See: getMiniBatchSize
setMiniBatchSize(val: number): void;valval argument (number).
getTermCriteria
Termination criteria of the algorithm. See: setTermCriteria
getTermCriteria(): TermCriteria;The TermCriteria result.
setTermCriteria
Termination criteria of the algorithm. See: setTermCriteria See: getTermCriteria
setTermCriteria(val: TermCriteria): void;valval argument (TermCriteria).
predict
Predicts responses for input samples and returns a float type.
predict(samples: Mat, results: Mat, flags: number): number;3 available overloads
predict(samples: Mat): number;predict(samples: Mat, results: Mat): number;predict(samples: Mat, results: Mat, flags: number): number;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.
resultsOutput destination, filled by the native operation. Predicted labels as a column matrix of type CV_32S.
flagsNot used.
The number result.
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.
get_learnt_thetas(): Mat;The Mat result. Release returned native handles with using or delete(), including handles nested in results.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.