Package org.opencv.ml
Class LogisticRegression
java.lang.Object
org.opencv.core.Algorithm
org.opencv.ml.StatModel
org.opencv.ml.LogisticRegression
public class LogisticRegression extends StatModel
Implements Logistic Regression classifier.
SEE: REF: ml_intro_lr
-
Field Summary
Fields Modifier and Type Field Description static int
BATCH
static int
MINI_BATCH
static int
REG_DISABLE
static int
REG_L1
static int
REG_L2
Fields inherited from class org.opencv.ml.StatModel
COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL
-
Constructor Summary
Constructors Modifier Constructor Description protected
LogisticRegression(long addr)
-
Method Summary
Modifier and Type Method Description static LogisticRegression
__fromPtr__(long addr)
static LogisticRegression
create()
Creates empty model.protected void
finalize()
Mat
get_learnt_thetas()
This function returns the trained parameters arranged across rows.int
getIterations()
SEE: setIterationsdouble
getLearningRate()
SEE: setLearningRateint
getMiniBatchSize()
SEE: setMiniBatchSizeint
getRegularization()
SEE: setRegularizationTermCriteria
getTermCriteria()
SEE: setTermCriteriaint
getTrainMethod()
SEE: setTrainMethodstatic LogisticRegression
load(String filepath)
Loads and creates a serialized LogisticRegression from a file Use LogisticRegression::save to serialize and store an LogisticRegression to disk.static LogisticRegression
load(String filepath, String nodeName)
Loads and creates a serialized LogisticRegression from a file Use LogisticRegression::save to serialize and store an LogisticRegression to disk.float
predict(Mat samples)
Predicts responses for input samples and returns a float type.float
predict(Mat samples, Mat results)
Predicts responses for input samples and returns a float type.float
predict(Mat samples, Mat results, int flags)
Predicts responses for input samples and returns a float type.void
setIterations(int val)
getIterations SEE: getIterationsvoid
setLearningRate(double val)
getLearningRate SEE: getLearningRatevoid
setMiniBatchSize(int val)
getMiniBatchSize SEE: getMiniBatchSizevoid
setRegularization(int val)
getRegularization SEE: getRegularizationvoid
setTermCriteria(TermCriteria val)
getTermCriteria SEE: getTermCriteriavoid
setTrainMethod(int val)
getTrainMethod SEE: getTrainMethodMethods inherited from class org.opencv.ml.StatModel
calcError, empty, getVarCount, isClassifier, isTrained, train, train, train
Methods inherited from class org.opencv.core.Algorithm
clear, getDefaultName, getNativeObjAddr, save
-
Field Details
-
BATCH
- See Also:
- Constant Field Values
-
MINI_BATCH
- See Also:
- Constant Field Values
-
REG_DISABLE
- See Also:
- Constant Field Values
-
REG_L1
- See Also:
- Constant Field Values
-
REG_L2
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Method Details
-
__fromPtr__
-
getLearningRate
SEE: setLearningRate- Returns:
- automatically generated
-
setLearningRate
getLearningRate SEE: getLearningRate- Parameters:
val
- automatically generated
-
getIterations
SEE: setIterations- Returns:
- automatically generated
-
setIterations
getIterations SEE: getIterations- Parameters:
val
- automatically generated
-
getRegularization
SEE: setRegularization- Returns:
- automatically generated
-
setRegularization
getRegularization SEE: getRegularization- Parameters:
val
- automatically generated
-
getTrainMethod
SEE: setTrainMethod- Returns:
- automatically generated
-
setTrainMethod
getTrainMethod SEE: getTrainMethod- Parameters:
val
- automatically generated
-
getMiniBatchSize
SEE: setMiniBatchSize- Returns:
- automatically generated
-
setMiniBatchSize
getMiniBatchSize SEE: getMiniBatchSize- Parameters:
val
- automatically generated
-
getTermCriteria
SEE: setTermCriteria- Returns:
- automatically generated
-
setTermCriteria
getTermCriteria SEE: getTermCriteria- Parameters:
val
- automatically generated
-
predict
Predicts responses for input samples and returns a float type.- Overrides:
predict
in classStatModel
- Parameters:
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.results
- Predicted labels as a column matrix of type CV_32S.flags
- Not used.- Returns:
- automatically generated
-
predict
Predicts responses for input samples and returns a float type.- Overrides:
predict
in classStatModel
- Parameters:
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.results
- Predicted labels as a column matrix of type CV_32S.- Returns:
- automatically generated
-
predict
Predicts responses for input samples and returns a float type. -
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.- Returns:
- automatically generated
-
create
Creates empty model. Creates Logistic Regression model with parameters given.- Returns:
- automatically generated
-
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- Parameters:
filepath
- path to serialized LogisticRegressionnodeName
- name of node containing the classifier- Returns:
- automatically generated
-
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- Parameters:
filepath
- path to serialized LogisticRegression- Returns:
- automatically generated
-
finalize
-