SVM.java 11.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519

//
// This file is auto-generated. Please don't modify it!
//
package org.opencv.ml;

import java.lang.String;
import org.opencv.core.Mat;
import org.opencv.core.TermCriteria;

// C++: class SVM
//javadoc: SVM

public class SVM extends StatModel {

    protected SVM(long addr) { super(addr); }


    public static final int
            C_SVC = 100,
            NU_SVC = 101,
            ONE_CLASS = 102,
            EPS_SVR = 103,
            NU_SVR = 104,
            CUSTOM = -1,
            LINEAR = 0,
            POLY = 1,
            RBF = 2,
            SIGMOID = 3,
            CHI2 = 4,
            INTER = 5,
            C = 0,
            GAMMA = 1,
            P = 2,
            NU = 3,
            COEF = 4,
            DEGREE = 5;


    //
    // C++:  Mat getClassWeights()
    //

    //javadoc: SVM::getClassWeights()
    public  Mat getClassWeights()
    {
        
        Mat retVal = new Mat(getClassWeights_0(nativeObj));
        
        return retVal;
    }


    //
    // C++:  Mat getSupportVectors()
    //

    //javadoc: SVM::getSupportVectors()
    public  Mat getSupportVectors()
    {
        
        Mat retVal = new Mat(getSupportVectors_0(nativeObj));
        
        return retVal;
    }


    //
    // C++:  Mat getUncompressedSupportVectors()
    //

    //javadoc: SVM::getUncompressedSupportVectors()
    public  Mat getUncompressedSupportVectors()
    {
        
        Mat retVal = new Mat(getUncompressedSupportVectors_0(nativeObj));
        
        return retVal;
    }


    //
    // C++: static Ptr_ParamGrid getDefaultGridPtr(int param_id)
    //

    //javadoc: SVM::getDefaultGridPtr(param_id)
    public static ParamGrid getDefaultGridPtr(int param_id)
    {
        
        ParamGrid retVal = new ParamGrid(getDefaultGridPtr_0(param_id));
        
        return retVal;
    }


    //
    // C++: static Ptr_SVM create()
    //

    //javadoc: SVM::create()
    public static SVM create()
    {
        
        SVM retVal = new SVM(create_0());
        
        return retVal;
    }


    //
    // C++: static Ptr_SVM load(String filepath)
    //

    //javadoc: SVM::load(filepath)
    public static SVM load(String filepath)
    {
        
        SVM retVal = new SVM(load_0(filepath));
        
        return retVal;
    }


    //
    // C++:  TermCriteria getTermCriteria()
    //

    //javadoc: SVM::getTermCriteria()
    public  TermCriteria getTermCriteria()
    {
        
        TermCriteria retVal = new TermCriteria(getTermCriteria_0(nativeObj));
        
        return retVal;
    }


    //
    // C++:  bool trainAuto(Mat samples, int layout, Mat responses, int kFold = 10, Ptr_ParamGrid Cgrid = SVM::getDefaultGridPtr(SVM::C), Ptr_ParamGrid gammaGrid = SVM::getDefaultGridPtr(SVM::GAMMA), Ptr_ParamGrid pGrid = SVM::getDefaultGridPtr(SVM::P), Ptr_ParamGrid nuGrid = SVM::getDefaultGridPtr(SVM::NU), Ptr_ParamGrid coeffGrid = SVM::getDefaultGridPtr(SVM::COEF), Ptr_ParamGrid degreeGrid = SVM::getDefaultGridPtr(SVM::DEGREE), bool balanced = false)
    //

    //javadoc: SVM::trainAuto(samples, layout, responses, kFold, Cgrid, gammaGrid, pGrid, nuGrid, coeffGrid, degreeGrid, balanced)
    public  boolean trainAuto(Mat samples, int layout, Mat responses, int kFold, ParamGrid Cgrid, ParamGrid gammaGrid, ParamGrid pGrid, ParamGrid nuGrid, ParamGrid coeffGrid, ParamGrid degreeGrid, boolean balanced)
    {
        
        boolean retVal = trainAuto_0(nativeObj, samples.nativeObj, layout, responses.nativeObj, kFold, Cgrid.getNativeObjAddr(), gammaGrid.getNativeObjAddr(), pGrid.getNativeObjAddr(), nuGrid.getNativeObjAddr(), coeffGrid.getNativeObjAddr(), degreeGrid.getNativeObjAddr(), balanced);
        
        return retVal;
    }

    //javadoc: SVM::trainAuto(samples, layout, responses)
    public  boolean trainAuto(Mat samples, int layout, Mat responses)
    {
        
        boolean retVal = trainAuto_1(nativeObj, samples.nativeObj, layout, responses.nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getC()
    //

    //javadoc: SVM::getC()
    public  double getC()
    {
        
        double retVal = getC_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getCoef0()
    //

    //javadoc: SVM::getCoef0()
    public  double getCoef0()
    {
        
        double retVal = getCoef0_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getDecisionFunction(int i, Mat& alpha, Mat& svidx)
    //

    //javadoc: SVM::getDecisionFunction(i, alpha, svidx)
    public  double getDecisionFunction(int i, Mat alpha, Mat svidx)
    {
        
        double retVal = getDecisionFunction_0(nativeObj, i, alpha.nativeObj, svidx.nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getDegree()
    //

    //javadoc: SVM::getDegree()
    public  double getDegree()
    {
        
        double retVal = getDegree_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getGamma()
    //

    //javadoc: SVM::getGamma()
    public  double getGamma()
    {
        
        double retVal = getGamma_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getNu()
    //

    //javadoc: SVM::getNu()
    public  double getNu()
    {
        
        double retVal = getNu_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  double getP()
    //

    //javadoc: SVM::getP()
    public  double getP()
    {
        
        double retVal = getP_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  int getKernelType()
    //

    //javadoc: SVM::getKernelType()
    public  int getKernelType()
    {
        
        int retVal = getKernelType_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  int getType()
    //

    //javadoc: SVM::getType()
    public  int getType()
    {
        
        int retVal = getType_0(nativeObj);
        
        return retVal;
    }


    //
    // C++:  void setC(double val)
    //

    //javadoc: SVM::setC(val)
    public  void setC(double val)
    {
        
        setC_0(nativeObj, val);
        
        return;
    }


    //
    // C++:  void setClassWeights(Mat val)
    //

    //javadoc: SVM::setClassWeights(val)
    public  void setClassWeights(Mat val)
    {
        
        setClassWeights_0(nativeObj, val.nativeObj);
        
        return;
    }


    //
    // C++:  void setCoef0(double val)
    //

    //javadoc: SVM::setCoef0(val)
    public  void setCoef0(double val)
    {
        
        setCoef0_0(nativeObj, val);
        
        return;
    }


    //
    // C++:  void setDegree(double val)
    //

    //javadoc: SVM::setDegree(val)
    public  void setDegree(double val)
    {
        
        setDegree_0(nativeObj, val);
        
        return;
    }


    //
    // C++:  void setGamma(double val)
    //

    //javadoc: SVM::setGamma(val)
    public  void setGamma(double val)
    {
        
        setGamma_0(nativeObj, val);
        
        return;
    }


    //
    // C++:  void setKernel(int kernelType)
    //

    //javadoc: SVM::setKernel(kernelType)
    public  void setKernel(int kernelType)
    {
        
        setKernel_0(nativeObj, kernelType);
        
        return;
    }


    //
    // C++:  void setNu(double val)
    //

    //javadoc: SVM::setNu(val)
    public  void setNu(double val)
    {
        
        setNu_0(nativeObj, val);
        
        return;
    }


    //
    // C++:  void setP(double val)
    //

    //javadoc: SVM::setP(val)
    public  void setP(double val)
    {
        
        setP_0(nativeObj, val);
        
        return;
    }


    //
    // C++:  void setTermCriteria(TermCriteria val)
    //

    //javadoc: SVM::setTermCriteria(val)
    public  void setTermCriteria(TermCriteria val)
    {
        
        setTermCriteria_0(nativeObj, val.type, val.maxCount, val.epsilon);
        
        return;
    }


    //
    // C++:  void setType(int val)
    //

    //javadoc: SVM::setType(val)
    public  void setType(int val)
    {
        
        setType_0(nativeObj, val);
        
        return;
    }


    @Override
    protected void finalize() throws Throwable {
        delete(nativeObj);
    }



    // C++:  Mat getClassWeights()
    private static native long getClassWeights_0(long nativeObj);

    // C++:  Mat getSupportVectors()
    private static native long getSupportVectors_0(long nativeObj);

    // C++:  Mat getUncompressedSupportVectors()
    private static native long getUncompressedSupportVectors_0(long nativeObj);

    // C++: static Ptr_ParamGrid getDefaultGridPtr(int param_id)
    private static native long getDefaultGridPtr_0(int param_id);

    // C++: static Ptr_SVM create()
    private static native long create_0();

    // C++: static Ptr_SVM load(String filepath)
    private static native long load_0(String filepath);

    // C++:  TermCriteria getTermCriteria()
    private static native double[] getTermCriteria_0(long nativeObj);

    // C++:  bool trainAuto(Mat samples, int layout, Mat responses, int kFold = 10, Ptr_ParamGrid Cgrid = SVM::getDefaultGridPtr(SVM::C), Ptr_ParamGrid gammaGrid = SVM::getDefaultGridPtr(SVM::GAMMA), Ptr_ParamGrid pGrid = SVM::getDefaultGridPtr(SVM::P), Ptr_ParamGrid nuGrid = SVM::getDefaultGridPtr(SVM::NU), Ptr_ParamGrid coeffGrid = SVM::getDefaultGridPtr(SVM::COEF), Ptr_ParamGrid degreeGrid = SVM::getDefaultGridPtr(SVM::DEGREE), bool balanced = false)
    private static native boolean trainAuto_0(long nativeObj, long samples_nativeObj, int layout, long responses_nativeObj, int kFold, long Cgrid_nativeObj, long gammaGrid_nativeObj, long pGrid_nativeObj, long nuGrid_nativeObj, long coeffGrid_nativeObj, long degreeGrid_nativeObj, boolean balanced);
    private static native boolean trainAuto_1(long nativeObj, long samples_nativeObj, int layout, long responses_nativeObj);

    // C++:  double getC()
    private static native double getC_0(long nativeObj);

    // C++:  double getCoef0()
    private static native double getCoef0_0(long nativeObj);

    // C++:  double getDecisionFunction(int i, Mat& alpha, Mat& svidx)
    private static native double getDecisionFunction_0(long nativeObj, int i, long alpha_nativeObj, long svidx_nativeObj);

    // C++:  double getDegree()
    private static native double getDegree_0(long nativeObj);

    // C++:  double getGamma()
    private static native double getGamma_0(long nativeObj);

    // C++:  double getNu()
    private static native double getNu_0(long nativeObj);

    // C++:  double getP()
    private static native double getP_0(long nativeObj);

    // C++:  int getKernelType()
    private static native int getKernelType_0(long nativeObj);

    // C++:  int getType()
    private static native int getType_0(long nativeObj);

    // C++:  void setC(double val)
    private static native void setC_0(long nativeObj, double val);

    // C++:  void setClassWeights(Mat val)
    private static native void setClassWeights_0(long nativeObj, long val_nativeObj);

    // C++:  void setCoef0(double val)
    private static native void setCoef0_0(long nativeObj, double val);

    // C++:  void setDegree(double val)
    private static native void setDegree_0(long nativeObj, double val);

    // C++:  void setGamma(double val)
    private static native void setGamma_0(long nativeObj, double val);

    // C++:  void setKernel(int kernelType)
    private static native void setKernel_0(long nativeObj, int kernelType);

    // C++:  void setNu(double val)
    private static native void setNu_0(long nativeObj, double val);

    // C++:  void setP(double val)
    private static native void setP_0(long nativeObj, double val);

    // C++:  void setTermCriteria(TermCriteria val)
    private static native void setTermCriteria_0(long nativeObj, int val_type, int val_maxCount, double val_epsilon);

    // C++:  void setType(int val)
    private static native void setType_0(long nativeObj, int val);

    // native support for java finalize()
    private static native void delete(long nativeObj);

}