LogisticRegression
Implements Logistic Regression classifier.
See
REF: ml_intro_lrMember of Ml
-
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.
-
Creates empty model.
Creates Logistic Regression model with parameters given.
Declaration
Objective-C
+ (nonnull LogisticRegression *)create;
Swift
class func create() -> LogisticRegression
-
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
Declaration
Objective-C
+ (nonnull LogisticRegression *)load:(nonnull NSString *)filepath nodeName:(nonnull NSString *)nodeName;
Swift
class func load(filepath: String, nodeName: String) -> LogisticRegression
Parameters
filepath
path to serialized LogisticRegression
nodeName
name of node containing the classifier
-
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
Declaration
Objective-C
+ (nonnull LogisticRegression *)load:(nonnull NSString *)filepath;
Swift
class func load(filepath: String) -> LogisticRegression
Parameters
filepath
path to serialized LogisticRegression
-
Declaration
Objective-C
- (nonnull TermCriteria *)getTermCriteria;
Swift
func getTermCriteria() -> TermCriteria
-
Declaration
Objective-C
- (double)getLearningRate;
Swift
func getLearningRate() -> Double
-
Predicts responses for input samples and returns a float type.
Declaration
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.
-
Predicts responses for input samples and returns a float type.
Declaration
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.
-
Predicts responses for input samples and returns a float type.
Declaration
Objective-C
- (float)predict:(nonnull Mat *)samples;
Swift
func predict(samples: Mat) -> Float
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.
-
See
-setIterations:
Declaration
Objective-C
- (int)getIterations;
Swift
func getIterations() -> Int32
-
Declaration
Objective-C
- (int)getMiniBatchSize;
Swift
func getMiniBatchSize() -> Int32
-
Declaration
Objective-C
- (int)getRegularization;
Swift
func getRegularization() -> Int32
-
See
-setTrainMethod:
Declaration
Objective-C
- (int)getTrainMethod;
Swift
func getTrainMethod() -> Int32
-
getIterations - see:
-getIterations:
Declaration
Objective-C
- (void)setIterations:(int)val;
Swift
func setIterations(val: Int32)
-
getLearningRate - see:
-getLearningRate:
Declaration
Objective-C
- (void)setLearningRate:(double)val;
Swift
func setLearningRate(val: Double)
-
getMiniBatchSize - see:
-getMiniBatchSize:
Declaration
Objective-C
- (void)setMiniBatchSize:(int)val;
Swift
func setMiniBatchSize(val: Int32)
-
getRegularization - see:
-getRegularization:
Declaration
Objective-C
- (void)setRegularization:(int)val;
Swift
func setRegularization(val: Int32)
-
getTermCriteria - see:
-getTermCriteria:
Declaration
Objective-C
- (void)setTermCriteria:(nonnull TermCriteria *)val;
Swift
func setTermCriteria(val: TermCriteria)
-
getTrainMethod - see:
-getTrainMethod:
Declaration
Objective-C
- (void)setTrainMethod:(int)val;
Swift
func setTrainMethod(val: Int32)