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.SVMSGD;
009import org.opencv.ml.StatModel;
010
011// C++: class SVMSGD
012/**
013 * *************************************************************************************\
014 * Stochastic Gradient Descent SVM Classifier                      *
015 * \***************************************************************************************
016 */
017public class SVMSGD extends StatModel {
018
019    protected SVMSGD(long addr) { super(addr); }
020
021    // internal usage only
022    public static SVMSGD __fromPtr__(long addr) { return new SVMSGD(addr); }
023
024    // C++: enum MarginType (cv.ml.SVMSGD.MarginType)
025    public static final int
026            SOFT_MARGIN = 0,
027            HARD_MARGIN = 1;
028
029
030    // C++: enum SvmsgdType (cv.ml.SVMSGD.SvmsgdType)
031    public static final int
032            SGD = 0,
033            ASGD = 1;
034
035
036    //
037    // C++:  Mat cv::ml::SVMSGD::getWeights()
038    //
039
040    /**
041     * @return the weights of the trained model (decision function f(x) = weights * x + shift).
042     */
043    public Mat getWeights() {
044        return new Mat(getWeights_0(nativeObj));
045    }
046
047
048    //
049    // C++:  float cv::ml::SVMSGD::getShift()
050    //
051
052    /**
053     * @return the shift of the trained model (decision function f(x) = weights * x + shift).
054     */
055    public float getShift() {
056        return getShift_0(nativeObj);
057    }
058
059
060    //
061    // C++: static Ptr_SVMSGD cv::ml::SVMSGD::create()
062    //
063
064    /**
065     * Creates empty model.
066     * Use StatModel::train to train the model. Since %SVMSGD has several parameters, you may want to
067     * find the best parameters for your problem or use setOptimalParameters() to set some default parameters.
068     * @return automatically generated
069     */
070    public static SVMSGD create() {
071        return SVMSGD.__fromPtr__(create_0());
072    }
073
074
075    //
076    // C++: static Ptr_SVMSGD cv::ml::SVMSGD::load(String filepath, String nodeName = String())
077    //
078
079    /**
080     * Loads and creates a serialized SVMSGD from a file
081     *
082     * Use SVMSGD::save to serialize and store an SVMSGD to disk.
083     * Load the SVMSGD from this file again, by calling this function with the path to the file.
084     * Optionally specify the node for the file containing the classifier
085     *
086     * @param filepath path to serialized SVMSGD
087     * @param nodeName name of node containing the classifier
088     * @return automatically generated
089     */
090    public static SVMSGD load(String filepath, String nodeName) {
091        return SVMSGD.__fromPtr__(load_0(filepath, nodeName));
092    }
093
094    /**
095     * Loads and creates a serialized SVMSGD from a file
096     *
097     * Use SVMSGD::save to serialize and store an SVMSGD to disk.
098     * Load the SVMSGD from this file again, by calling this function with the path to the file.
099     * Optionally specify the node for the file containing the classifier
100     *
101     * @param filepath path to serialized SVMSGD
102     * @return automatically generated
103     */
104    public static SVMSGD load(String filepath) {
105        return SVMSGD.__fromPtr__(load_1(filepath));
106    }
107
108
109    //
110    // C++:  void cv::ml::SVMSGD::setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN)
111    //
112
113    /**
114     * Function sets optimal parameters values for chosen SVM SGD model.
115     * @param svmsgdType is the type of SVMSGD classifier.
116     * @param marginType is the type of margin constraint.
117     */
118    public void setOptimalParameters(int svmsgdType, int marginType) {
119        setOptimalParameters_0(nativeObj, svmsgdType, marginType);
120    }
121
122    /**
123     * Function sets optimal parameters values for chosen SVM SGD model.
124     * @param svmsgdType is the type of SVMSGD classifier.
125     */
126    public void setOptimalParameters(int svmsgdType) {
127        setOptimalParameters_1(nativeObj, svmsgdType);
128    }
129
130    /**
131     * Function sets optimal parameters values for chosen SVM SGD model.
132     */
133    public void setOptimalParameters() {
134        setOptimalParameters_2(nativeObj);
135    }
136
137
138    //
139    // C++:  int cv::ml::SVMSGD::getSvmsgdType()
140    //
141
142    /**
143     * SEE: setSvmsgdType
144     * @return automatically generated
145     */
146    public int getSvmsgdType() {
147        return getSvmsgdType_0(nativeObj);
148    }
149
150
151    //
152    // C++:  void cv::ml::SVMSGD::setSvmsgdType(int svmsgdType)
153    //
154
155    /**
156     *  getSvmsgdType SEE: getSvmsgdType
157     * @param svmsgdType automatically generated
158     */
159    public void setSvmsgdType(int svmsgdType) {
160        setSvmsgdType_0(nativeObj, svmsgdType);
161    }
162
163
164    //
165    // C++:  int cv::ml::SVMSGD::getMarginType()
166    //
167
168    /**
169     * SEE: setMarginType
170     * @return automatically generated
171     */
172    public int getMarginType() {
173        return getMarginType_0(nativeObj);
174    }
175
176
177    //
178    // C++:  void cv::ml::SVMSGD::setMarginType(int marginType)
179    //
180
181    /**
182     *  getMarginType SEE: getMarginType
183     * @param marginType automatically generated
184     */
185    public void setMarginType(int marginType) {
186        setMarginType_0(nativeObj, marginType);
187    }
188
189
190    //
191    // C++:  float cv::ml::SVMSGD::getMarginRegularization()
192    //
193
194    /**
195     * SEE: setMarginRegularization
196     * @return automatically generated
197     */
198    public float getMarginRegularization() {
199        return getMarginRegularization_0(nativeObj);
200    }
201
202
203    //
204    // C++:  void cv::ml::SVMSGD::setMarginRegularization(float marginRegularization)
205    //
206
207    /**
208     *  getMarginRegularization SEE: getMarginRegularization
209     * @param marginRegularization automatically generated
210     */
211    public void setMarginRegularization(float marginRegularization) {
212        setMarginRegularization_0(nativeObj, marginRegularization);
213    }
214
215
216    //
217    // C++:  float cv::ml::SVMSGD::getInitialStepSize()
218    //
219
220    /**
221     * SEE: setInitialStepSize
222     * @return automatically generated
223     */
224    public float getInitialStepSize() {
225        return getInitialStepSize_0(nativeObj);
226    }
227
228
229    //
230    // C++:  void cv::ml::SVMSGD::setInitialStepSize(float InitialStepSize)
231    //
232
233    /**
234     *  getInitialStepSize SEE: getInitialStepSize
235     * @param InitialStepSize automatically generated
236     */
237    public void setInitialStepSize(float InitialStepSize) {
238        setInitialStepSize_0(nativeObj, InitialStepSize);
239    }
240
241
242    //
243    // C++:  float cv::ml::SVMSGD::getStepDecreasingPower()
244    //
245
246    /**
247     * SEE: setStepDecreasingPower
248     * @return automatically generated
249     */
250    public float getStepDecreasingPower() {
251        return getStepDecreasingPower_0(nativeObj);
252    }
253
254
255    //
256    // C++:  void cv::ml::SVMSGD::setStepDecreasingPower(float stepDecreasingPower)
257    //
258
259    /**
260     *  getStepDecreasingPower SEE: getStepDecreasingPower
261     * @param stepDecreasingPower automatically generated
262     */
263    public void setStepDecreasingPower(float stepDecreasingPower) {
264        setStepDecreasingPower_0(nativeObj, stepDecreasingPower);
265    }
266
267
268    //
269    // C++:  TermCriteria cv::ml::SVMSGD::getTermCriteria()
270    //
271
272    /**
273     * SEE: setTermCriteria
274     * @return automatically generated
275     */
276    public TermCriteria getTermCriteria() {
277        return new TermCriteria(getTermCriteria_0(nativeObj));
278    }
279
280
281    //
282    // C++:  void cv::ml::SVMSGD::setTermCriteria(TermCriteria val)
283    //
284
285    /**
286     *  getTermCriteria SEE: getTermCriteria
287     * @param val automatically generated
288     */
289    public void setTermCriteria(TermCriteria val) {
290        setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
291    }
292
293
294    @Override
295    protected void finalize() throws Throwable {
296        delete(nativeObj);
297    }
298
299
300
301    // C++:  Mat cv::ml::SVMSGD::getWeights()
302    private static native long getWeights_0(long nativeObj);
303
304    // C++:  float cv::ml::SVMSGD::getShift()
305    private static native float getShift_0(long nativeObj);
306
307    // C++: static Ptr_SVMSGD cv::ml::SVMSGD::create()
308    private static native long create_0();
309
310    // C++: static Ptr_SVMSGD cv::ml::SVMSGD::load(String filepath, String nodeName = String())
311    private static native long load_0(String filepath, String nodeName);
312    private static native long load_1(String filepath);
313
314    // C++:  void cv::ml::SVMSGD::setOptimalParameters(int svmsgdType = SVMSGD::ASGD, int marginType = SVMSGD::SOFT_MARGIN)
315    private static native void setOptimalParameters_0(long nativeObj, int svmsgdType, int marginType);
316    private static native void setOptimalParameters_1(long nativeObj, int svmsgdType);
317    private static native void setOptimalParameters_2(long nativeObj);
318
319    // C++:  int cv::ml::SVMSGD::getSvmsgdType()
320    private static native int getSvmsgdType_0(long nativeObj);
321
322    // C++:  void cv::ml::SVMSGD::setSvmsgdType(int svmsgdType)
323    private static native void setSvmsgdType_0(long nativeObj, int svmsgdType);
324
325    // C++:  int cv::ml::SVMSGD::getMarginType()
326    private static native int getMarginType_0(long nativeObj);
327
328    // C++:  void cv::ml::SVMSGD::setMarginType(int marginType)
329    private static native void setMarginType_0(long nativeObj, int marginType);
330
331    // C++:  float cv::ml::SVMSGD::getMarginRegularization()
332    private static native float getMarginRegularization_0(long nativeObj);
333
334    // C++:  void cv::ml::SVMSGD::setMarginRegularization(float marginRegularization)
335    private static native void setMarginRegularization_0(long nativeObj, float marginRegularization);
336
337    // C++:  float cv::ml::SVMSGD::getInitialStepSize()
338    private static native float getInitialStepSize_0(long nativeObj);
339
340    // C++:  void cv::ml::SVMSGD::setInitialStepSize(float InitialStepSize)
341    private static native void setInitialStepSize_0(long nativeObj, float InitialStepSize);
342
343    // C++:  float cv::ml::SVMSGD::getStepDecreasingPower()
344    private static native float getStepDecreasingPower_0(long nativeObj);
345
346    // C++:  void cv::ml::SVMSGD::setStepDecreasingPower(float stepDecreasingPower)
347    private static native void setStepDecreasingPower_0(long nativeObj, float stepDecreasingPower);
348
349    // C++:  TermCriteria cv::ml::SVMSGD::getTermCriteria()
350    private static native double[] getTermCriteria_0(long nativeObj);
351
352    // C++:  void cv::ml::SVMSGD::setTermCriteria(TermCriteria val)
353    private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);
354
355    // native support for java finalize()
356    private static native void delete(long nativeObj);
357
358}