001//
002// This file is auto-generated. Please don't modify it!
003//
004package org.opencv.ml;
005
006import org.opencv.core.Mat;
007import org.opencv.core.TermCriteria;
008import org.opencv.ml.LogisticRegression;
009import org.opencv.ml.StatModel;
010
011// C++: class LogisticRegression
012/**
013 * Implements Logistic Regression classifier.
014 *
015 * SEE: REF: ml_intro_lr
016 */
017public class LogisticRegression extends StatModel {
018
019    protected LogisticRegression(long addr) { super(addr); }
020
021    // internal usage only
022    public static LogisticRegression __fromPtr__(long addr) { return new LogisticRegression(addr); }
023
024    // C++: enum Methods (cv.ml.LogisticRegression.Methods)
025    public static final int
026            BATCH = 0,
027            MINI_BATCH = 1;
028
029
030    // C++: enum RegKinds (cv.ml.LogisticRegression.RegKinds)
031    public static final int
032            REG_DISABLE = -1,
033            REG_L1 = 0,
034            REG_L2 = 1;
035
036
037    //
038    // C++:  double cv::ml::LogisticRegression::getLearningRate()
039    //
040
041    /**
042     * SEE: setLearningRate
043     * @return automatically generated
044     */
045    public double getLearningRate() {
046        return getLearningRate_0(nativeObj);
047    }
048
049
050    //
051    // C++:  void cv::ml::LogisticRegression::setLearningRate(double val)
052    //
053
054    /**
055     *  getLearningRate SEE: getLearningRate
056     * @param val automatically generated
057     */
058    public void setLearningRate(double val) {
059        setLearningRate_0(nativeObj, val);
060    }
061
062
063    //
064    // C++:  int cv::ml::LogisticRegression::getIterations()
065    //
066
067    /**
068     * SEE: setIterations
069     * @return automatically generated
070     */
071    public int getIterations() {
072        return getIterations_0(nativeObj);
073    }
074
075
076    //
077    // C++:  void cv::ml::LogisticRegression::setIterations(int val)
078    //
079
080    /**
081     *  getIterations SEE: getIterations
082     * @param val automatically generated
083     */
084    public void setIterations(int val) {
085        setIterations_0(nativeObj, val);
086    }
087
088
089    //
090    // C++:  int cv::ml::LogisticRegression::getRegularization()
091    //
092
093    /**
094     * SEE: setRegularization
095     * @return automatically generated
096     */
097    public int getRegularization() {
098        return getRegularization_0(nativeObj);
099    }
100
101
102    //
103    // C++:  void cv::ml::LogisticRegression::setRegularization(int val)
104    //
105
106    /**
107     *  getRegularization SEE: getRegularization
108     * @param val automatically generated
109     */
110    public void setRegularization(int val) {
111        setRegularization_0(nativeObj, val);
112    }
113
114
115    //
116    // C++:  int cv::ml::LogisticRegression::getTrainMethod()
117    //
118
119    /**
120     * SEE: setTrainMethod
121     * @return automatically generated
122     */
123    public int getTrainMethod() {
124        return getTrainMethod_0(nativeObj);
125    }
126
127
128    //
129    // C++:  void cv::ml::LogisticRegression::setTrainMethod(int val)
130    //
131
132    /**
133     *  getTrainMethod SEE: getTrainMethod
134     * @param val automatically generated
135     */
136    public void setTrainMethod(int val) {
137        setTrainMethod_0(nativeObj, val);
138    }
139
140
141    //
142    // C++:  int cv::ml::LogisticRegression::getMiniBatchSize()
143    //
144
145    /**
146     * SEE: setMiniBatchSize
147     * @return automatically generated
148     */
149    public int getMiniBatchSize() {
150        return getMiniBatchSize_0(nativeObj);
151    }
152
153
154    //
155    // C++:  void cv::ml::LogisticRegression::setMiniBatchSize(int val)
156    //
157
158    /**
159     *  getMiniBatchSize SEE: getMiniBatchSize
160     * @param val automatically generated
161     */
162    public void setMiniBatchSize(int val) {
163        setMiniBatchSize_0(nativeObj, val);
164    }
165
166
167    //
168    // C++:  TermCriteria cv::ml::LogisticRegression::getTermCriteria()
169    //
170
171    /**
172     * SEE: setTermCriteria
173     * @return automatically generated
174     */
175    public TermCriteria getTermCriteria() {
176        return new TermCriteria(getTermCriteria_0(nativeObj));
177    }
178
179
180    //
181    // C++:  void cv::ml::LogisticRegression::setTermCriteria(TermCriteria val)
182    //
183
184    /**
185     *  getTermCriteria SEE: getTermCriteria
186     * @param val automatically generated
187     */
188    public void setTermCriteria(TermCriteria val) {
189        setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
190    }
191
192
193    //
194    // C++:  float cv::ml::LogisticRegression::predict(Mat samples, Mat& results = Mat(), int flags = 0)
195    //
196
197    /**
198     * Predicts responses for input samples and returns a float type.
199     *
200     *     @param samples The input data for the prediction algorithm. Matrix [m x n], where each row
201     *         contains variables (features) of one object being classified. Should have data type CV_32F.
202     *     @param results Predicted labels as a column matrix of type CV_32S.
203     *     @param flags Not used.
204     * @return automatically generated
205     */
206    public float predict(Mat samples, Mat results, int flags) {
207        return predict_0(nativeObj, samples.nativeObj, results.nativeObj, flags);
208    }
209
210    /**
211     * Predicts responses for input samples and returns a float type.
212     *
213     *     @param samples The input data for the prediction algorithm. Matrix [m x n], where each row
214     *         contains variables (features) of one object being classified. Should have data type CV_32F.
215     *     @param results Predicted labels as a column matrix of type CV_32S.
216     * @return automatically generated
217     */
218    public float predict(Mat samples, Mat results) {
219        return predict_1(nativeObj, samples.nativeObj, results.nativeObj);
220    }
221
222    /**
223     * Predicts responses for input samples and returns a float type.
224     *
225     *     @param samples The input data for the prediction algorithm. Matrix [m x n], where each row
226     *         contains variables (features) of one object being classified. Should have data type CV_32F.
227     * @return automatically generated
228     */
229    public float predict(Mat samples) {
230        return predict_2(nativeObj, samples.nativeObj);
231    }
232
233
234    //
235    // C++:  Mat cv::ml::LogisticRegression::get_learnt_thetas()
236    //
237
238    /**
239     * This function returns the trained parameters arranged across rows.
240     *
241     *     For a two class classification problem, it returns a row matrix. It returns learnt parameters of
242     *     the Logistic Regression as a matrix of type CV_32F.
243     * @return automatically generated
244     */
245    public Mat get_learnt_thetas() {
246        return new Mat(get_learnt_thetas_0(nativeObj));
247    }
248
249
250    //
251    // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::create()
252    //
253
254    /**
255     * Creates empty model.
256     *
257     *     Creates Logistic Regression model with parameters given.
258     * @return automatically generated
259     */
260    public static LogisticRegression create() {
261        return LogisticRegression.__fromPtr__(create_0());
262    }
263
264
265    //
266    // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::load(String filepath, String nodeName = String())
267    //
268
269    /**
270     * Loads and creates a serialized LogisticRegression from a file
271     *
272     * Use LogisticRegression::save to serialize and store an LogisticRegression to disk.
273     * Load the LogisticRegression from this file again, by calling this function with the path to the file.
274     * Optionally specify the node for the file containing the classifier
275     *
276     * @param filepath path to serialized LogisticRegression
277     * @param nodeName name of node containing the classifier
278     * @return automatically generated
279     */
280    public static LogisticRegression load(String filepath, String nodeName) {
281        return LogisticRegression.__fromPtr__(load_0(filepath, nodeName));
282    }
283
284    /**
285     * Loads and creates a serialized LogisticRegression from a file
286     *
287     * Use LogisticRegression::save to serialize and store an LogisticRegression to disk.
288     * Load the LogisticRegression from this file again, by calling this function with the path to the file.
289     * Optionally specify the node for the file containing the classifier
290     *
291     * @param filepath path to serialized LogisticRegression
292     * @return automatically generated
293     */
294    public static LogisticRegression load(String filepath) {
295        return LogisticRegression.__fromPtr__(load_1(filepath));
296    }
297
298
299    @Override
300    protected void finalize() throws Throwable {
301        delete(nativeObj);
302    }
303
304
305
306    // C++:  double cv::ml::LogisticRegression::getLearningRate()
307    private static native double getLearningRate_0(long nativeObj);
308
309    // C++:  void cv::ml::LogisticRegression::setLearningRate(double val)
310    private static native void setLearningRate_0(long nativeObj, double val);
311
312    // C++:  int cv::ml::LogisticRegression::getIterations()
313    private static native int getIterations_0(long nativeObj);
314
315    // C++:  void cv::ml::LogisticRegression::setIterations(int val)
316    private static native void setIterations_0(long nativeObj, int val);
317
318    // C++:  int cv::ml::LogisticRegression::getRegularization()
319    private static native int getRegularization_0(long nativeObj);
320
321    // C++:  void cv::ml::LogisticRegression::setRegularization(int val)
322    private static native void setRegularization_0(long nativeObj, int val);
323
324    // C++:  int cv::ml::LogisticRegression::getTrainMethod()
325    private static native int getTrainMethod_0(long nativeObj);
326
327    // C++:  void cv::ml::LogisticRegression::setTrainMethod(int val)
328    private static native void setTrainMethod_0(long nativeObj, int val);
329
330    // C++:  int cv::ml::LogisticRegression::getMiniBatchSize()
331    private static native int getMiniBatchSize_0(long nativeObj);
332
333    // C++:  void cv::ml::LogisticRegression::setMiniBatchSize(int val)
334    private static native void setMiniBatchSize_0(long nativeObj, int val);
335
336    // C++:  TermCriteria cv::ml::LogisticRegression::getTermCriteria()
337    private static native double[] getTermCriteria_0(long nativeObj);
338
339    // C++:  void cv::ml::LogisticRegression::setTermCriteria(TermCriteria val)
340    private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
341
342    // C++:  float cv::ml::LogisticRegression::predict(Mat samples, Mat& results = Mat(), int flags = 0)
343    private static native float predict_0(long nativeObj, long samples_nativeObj, long results_nativeObj, int flags);
344    private static native float predict_1(long nativeObj, long samples_nativeObj, long results_nativeObj);
345    private static native float predict_2(long nativeObj, long samples_nativeObj);
346
347    // C++:  Mat cv::ml::LogisticRegression::get_learnt_thetas()
348    private static native long get_learnt_thetas_0(long nativeObj);
349
350    // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::create()
351    private static native long create_0();
352
353    // C++: static Ptr_LogisticRegression cv::ml::LogisticRegression::load(String filepath, String nodeName = String())
354    private static native long load_0(String filepath, String nodeName);
355    private static native long load_1(String filepath);
356
357    // native support for java finalize()
358    private static native void delete(long nativeObj);
359
360}