Package org.opencv.ml

## Class SVMSGD

- java.lang.Object
- - org.opencv.core.Algorithm
  - - org.opencv.ml.StatModel
    - - org.opencv.ml.SVMSGD

-     public class SVMSGD
      extends StatModel

  *************************************************************************************\ Stochastic Gradient Descent SVM Classifier * \***************************************************************************************

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `ASGD` |
    `static int` | `HARD_MARGIN` |
    `static int` | `SGD` |
    `static int` | `SOFT_MARGIN` |

    - ### Fields inherited from class org.opencv.ml.StatModel

      `COMPRESSED_INPUT, PREPROCESSED_INPUT, RAW_OUTPUT, UPDATE_MODEL`

    - ### Fields inherited from class org.opencv.core.Algorithm

      `nativeObj`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `SVMSGD​(long addr)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SVMSGD` | `__fromPtr__​(long addr)` |
    `static SVMSGD` | `create()` | Creates empty model.
    `protected void` | `finalize()` |
    `float` | `getInitialStepSize()` | SEE: setInitialStepSize
    `float` | `getMarginRegularization()` | SEE: setMarginRegularization
    `int` | `getMarginType()` | SEE: setMarginType
    `float` | `getShift()` |
    `float` | `getStepDecreasingPower()` | SEE: setStepDecreasingPower
    `int` | `getSvmsgdType()` | SEE: setSvmsgdType
    `TermCriteria` | `getTermCriteria()` | SEE: setTermCriteria
    `Mat` | `getWeights()` |
    `static SVMSGD` | `load​(java.lang.String filepath)` | Loads and creates a serialized SVMSGD from a file Use SVMSGD::save to serialize and store an SVMSGD to disk.
    `static SVMSGD` | `load​(java.lang.String filepath, java.lang.String nodeName)` | Loads and creates a serialized SVMSGD from a file Use SVMSGD::save to serialize and store an SVMSGD to disk.
    `void` | `setInitialStepSize​(float InitialStepSize)` | getInitialStepSize SEE: getInitialStepSize
    `void` | `setMarginRegularization​(float marginRegularization)` | getMarginRegularization SEE: getMarginRegularization
    `void` | `setMarginType​(int marginType)` | getMarginType SEE: getMarginType
    `void` | `setOptimalParameters()` | Function sets optimal parameters values for chosen SVM SGD model.
    `void` | `setOptimalParameters​(int svmsgdType)` | Function sets optimal parameters values for chosen SVM SGD model.
    `void` | `setOptimalParameters​(int svmsgdType, int marginType)` | Function sets optimal parameters values for chosen SVM SGD model.
    `void` | `setStepDecreasingPower​(float stepDecreasingPower)` | getStepDecreasingPower SEE: getStepDecreasingPower
    `void` | `setSvmsgdType​(int svmsgdType)` | getSvmsgdType SEE: getSvmsgdType
    `void` | `setTermCriteria​(TermCriteria val)` | getTermCriteria SEE: getTermCriteria

    - ### Methods inherited from class org.opencv.ml.StatModel

      `calcError, empty, getVarCount, isClassifier, isTrained, predict, predict, predict, train, train, train`

    - ### Methods inherited from class org.opencv.core.Algorithm

      `clear, getDefaultName, getNativeObjAddr, save`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SOFT_MARGIN

          public static final int SOFT_MARGIN

      See Also:
        Constant Field Values

    - #### HARD_MARGIN

          public static final int HARD_MARGIN

      See Also:
        Constant Field Values

    - #### SGD

          public static final int SGD

      See Also:
        Constant Field Values

    - #### ASGD

          public static final int ASGD

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SVMSGD

          protected SVMSGD​(long addr)

  - ### Method Detail

    - #### __fromPtr__

          public static SVMSGD __fromPtr__​(long addr)

    - #### getWeights

          public Mat getWeights()

      Returns:
        the weights of the trained model (decision function f(x) = weights * x + shift).

    - #### create

          public static SVMSGD create()

      Creates empty model. Use StatModel::train to train the model. Since %SVMSGD has several parameters, you may want to find the best parameters for your problem or use setOptimalParameters() to set some default parameters.
      Returns:
        automatically generated

    - #### load

          public static SVMSGD load​(java.lang.String filepath,
                                    java.lang.String nodeName)

      Loads and creates a serialized SVMSGD from a file Use SVMSGD::save to serialize and store an SVMSGD to disk. Load the SVMSGD 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 SVMSGD
        `nodeName` - name of node containing the classifier
      Returns:
        automatically generated

    - #### load

          public static SVMSGD load​(java.lang.String filepath)

      Loads and creates a serialized SVMSGD from a file Use SVMSGD::save to serialize and store an SVMSGD to disk. Load the SVMSGD 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 SVMSGD
      Returns:
        automatically generated

    - #### getTermCriteria

          public TermCriteria getTermCriteria()

      SEE: setTermCriteria
      Returns:
        automatically generated

    - #### getInitialStepSize

          public float getInitialStepSize()

      SEE: setInitialStepSize
      Returns:
        automatically generated

    - #### getMarginRegularization

          public float getMarginRegularization()

      SEE: setMarginRegularization
      Returns:
        automatically generated

    - #### getShift

          public float getShift()

      Returns:
        the shift of the trained model (decision function f(x) = weights * x + shift).

    - #### getStepDecreasingPower

          public float getStepDecreasingPower()

      SEE: setStepDecreasingPower
      Returns:
        automatically generated

    - #### getMarginType

          public int getMarginType()

      SEE: setMarginType
      Returns:
        automatically generated

    - #### getSvmsgdType

          public int getSvmsgdType()

      SEE: setSvmsgdType
      Returns:
        automatically generated

    - #### setInitialStepSize

          public void setInitialStepSize​(float InitialStepSize)

      getInitialStepSize SEE: getInitialStepSize
      Parameters:
        `InitialStepSize` - automatically generated

    - #### setMarginRegularization

          public void setMarginRegularization​(float marginRegularization)

      getMarginRegularization SEE: getMarginRegularization
      Parameters:
        `marginRegularization` - automatically generated

    - #### setMarginType

          public void setMarginType​(int marginType)

      getMarginType SEE: getMarginType
      Parameters:
        `marginType` - automatically generated

    - #### setOptimalParameters

          public void setOptimalParameters​(int svmsgdType,
                                           int marginType)

      Function sets optimal parameters values for chosen SVM SGD model.
      Parameters:
        `svmsgdType` - is the type of SVMSGD classifier.
        `marginType` - is the type of margin constraint.

    - #### setOptimalParameters

          public void setOptimalParameters​(int svmsgdType)

      Function sets optimal parameters values for chosen SVM SGD model.
      Parameters:
        `svmsgdType` - is the type of SVMSGD classifier.

    - #### setOptimalParameters

          public void setOptimalParameters()

      Function sets optimal parameters values for chosen SVM SGD model.

    - #### setStepDecreasingPower

          public void setStepDecreasingPower​(float stepDecreasingPower)

      getStepDecreasingPower SEE: getStepDecreasingPower
      Parameters:
        `stepDecreasingPower` - automatically generated

    - #### setSvmsgdType

          public void setSvmsgdType​(int svmsgdType)

      getSvmsgdType SEE: getSvmsgdType
      Parameters:
        `svmsgdType` - automatically generated

    - #### setTermCriteria

          public void setTermCriteria​(TermCriteria val)

      getTermCriteria SEE: getTermCriteria
      Parameters:
        `val` - automatically generated

    - #### finalize

          protected void finalize()
                           throws java.lang.Throwable

      Overrides:
        `finalize` in class `StatModel`
      Throws:
        `java.lang.Throwable`