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 SummaryFields Modifier and Type Field Description static intBATCHstatic intMINI_BATCHstatic intREG_DISABLEstatic intREG_L1static intREG_L2- 
Fields inherited from class org.opencv.ml.StatModelCOMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedLogisticRegression(long addr)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LogisticRegression__fromPtr__(long addr)static LogisticRegressioncreate()Creates empty model.protected voidfinalize()Matget_learnt_thetas()This function returns the trained parameters arranged across rows.intgetIterations()SEE: setIterationsdoublegetLearningRate()SEE: setLearningRateintgetMiniBatchSize()SEE: setMiniBatchSizeintgetRegularization()SEE: setRegularizationTermCriteriagetTermCriteria()SEE: setTermCriteriaintgetTrainMethod()SEE: setTrainMethodstatic LogisticRegressionload(java.lang.String filepath)Loads and creates a serialized LogisticRegression from a file Use LogisticRegression::save to serialize and store an LogisticRegression to disk.static LogisticRegressionload(java.lang.String filepath, java.lang.String nodeName)Loads and creates a serialized LogisticRegression from a file Use LogisticRegression::save to serialize and store an LogisticRegression to disk.floatpredict(Mat samples)Predicts responses for input samples and returns a float type.floatpredict(Mat samples, Mat results)Predicts responses for input samples and returns a float type.floatpredict(Mat samples, Mat results, int flags)Predicts responses for input samples and returns a float type.voidsetIterations(int val)getIterations SEE: getIterationsvoidsetLearningRate(double val)getLearningRate SEE: getLearningRatevoidsetMiniBatchSize(int val)getMiniBatchSize SEE: getMiniBatchSizevoidsetRegularization(int val)getRegularization SEE: getRegularizationvoidsetTermCriteria(TermCriteria val)getTermCriteria SEE: getTermCriteriavoidsetTrainMethod(int val)getTrainMethod SEE: getTrainMethod- 
Methods inherited from class org.opencv.ml.StatModelcalcError, empty, getVarCount, isClassifier, isTrained, train, train, train
 - 
Methods inherited from class org.opencv.core.Algorithmclear, getDefaultName, getNativeObjAddr, save
 
- 
 
- 
- 
- 
Field Detail- 
BATCHpublic static final int BATCH - See Also:
- Constant Field Values
 
 - 
MINI_BATCHpublic static final int MINI_BATCH - See Also:
- Constant Field Values
 
 - 
REG_DISABLEpublic static final int REG_DISABLE - See Also:
- Constant Field Values
 
 - 
REG_L1public static final int REG_L1 - See Also:
- Constant Field Values
 
 - 
REG_L2public static final int REG_L2 - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
__fromPtr__public static LogisticRegression __fromPtr__(long addr) 
 - 
getLearningRatepublic double getLearningRate() SEE: setLearningRate- Returns:
- automatically generated
 
 - 
setLearningRatepublic void setLearningRate(double val) getLearningRate SEE: getLearningRate- Parameters:
- val- automatically generated
 
 - 
getIterationspublic int getIterations() SEE: setIterations- Returns:
- automatically generated
 
 - 
setIterationspublic void setIterations(int val) getIterations SEE: getIterations- Parameters:
- val- automatically generated
 
 - 
getRegularizationpublic int getRegularization() SEE: setRegularization- Returns:
- automatically generated
 
 - 
setRegularizationpublic void setRegularization(int val) getRegularization SEE: getRegularization- Parameters:
- val- automatically generated
 
 - 
getTrainMethodpublic int getTrainMethod() SEE: setTrainMethod- Returns:
- automatically generated
 
 - 
setTrainMethodpublic void setTrainMethod(int val) getTrainMethod SEE: getTrainMethod- Parameters:
- val- automatically generated
 
 - 
getMiniBatchSizepublic int getMiniBatchSize() SEE: setMiniBatchSize- Returns:
- automatically generated
 
 - 
setMiniBatchSizepublic void setMiniBatchSize(int val) getMiniBatchSize SEE: getMiniBatchSize- Parameters:
- val- automatically generated
 
 - 
getTermCriteriapublic TermCriteria getTermCriteria() SEE: setTermCriteria- Returns:
- automatically generated
 
 - 
setTermCriteriapublic void setTermCriteria(TermCriteria val) getTermCriteria SEE: getTermCriteria- Parameters:
- val- automatically generated
 
 - 
predictpublic float predict(Mat samples, Mat results, int flags) Predicts responses for input samples and returns a float type.- Overrides:
- predictin class- StatModel
- 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
 
 - 
predictpublic float predict(Mat samples, Mat results) Predicts responses for input samples and returns a float type.- Overrides:
- predictin class- StatModel
- 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
 
 - 
predictpublic float predict(Mat samples) Predicts responses for input samples and returns a float type.
 - 
get_learnt_thetaspublic Mat 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
 
 - 
createpublic static LogisticRegression create() Creates empty model. Creates Logistic Regression model with parameters given.- Returns:
- automatically generated
 
 - 
loadpublic static LogisticRegression load(java.lang.String filepath, java.lang.String nodeName) 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
- nodeName- name of node containing the classifier
- Returns:
- automatically generated
 
 - 
loadpublic static LogisticRegression load(java.lang.String filepath) 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
 
 
- 
 
-