org.apache.ignite.ml.recommendation.util

## Class MatrixFactorizationGradient<O extends Serializable,S extends Serializable>

- java.lang.Object
- - org.apache.ignite.ml.recommendation.util.MatrixFactorizationGradient<O,S>

- Type Parameters:
    `O` - Type of an object of recommendation.
    `S` - Type of a subject of recommendation.
  All Implemented Interfaces:
    Serializable

      public class MatrixFactorizationGradient<O extends Serializable,S extends Serializable>
      extends Object
      implements Serializable

  Gradient of matrix factorization loss function.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MatrixFactorizationGradient(Map<O,Vector> objGrad, Map<S,Vector> subjGrad, int rows)` Constructs a new instance of matrix factorization gradient.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `applyGradient(Map<O,Vector> objMatrix, Map<S,Vector> subjMatrix)` Applies given gradient to recommendation model (object matrix and subject matrix) and updates this model correspondingly.
    `Map<O,Vector>` | `getObjGrad()` Returns gradient of object of recommendation matrix (unmodifiable).
    `int` | `getRows()` Returns number of rows the gradient calculated on.
    `Map<S,Vector>` | `getSubjGrad()` Returns gradient of subject of recommendation function (unmodifiable).

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

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

- - ### Constructor Detail

    - #### MatrixFactorizationGradient

          public MatrixFactorizationGradient(Map<O,Vector> objGrad,
                                             Map<S,Vector> subjGrad,
                                             int rows)

      Constructs a new instance of matrix factorization gradient.
      Parameters:
        `objGrad` - Gradient of object of recommendation matrix.
        `subjGrad` - Gradient of subject of recommendation matrix.
        `rows` - Number of rows the gradient calculated on.

  - ### Method Detail

    - #### applyGradient

          public void applyGradient(Map<O,Vector> objMatrix,
                                    Map<S,Vector> subjMatrix)

      Applies given gradient to recommendation model (object matrix and subject matrix) and updates this model correspondingly.
      Parameters:
        `objMatrix` - Object of recommendation matrix.
        `subjMatrix` - Subject of recommendation matrix.

    - #### getObjGrad

          public Map<O,Vector> getObjGrad()

      Returns gradient of object of recommendation matrix (unmodifiable).
      Returns:
        Gradient of object of recommendation matrix.

    - #### getSubjGrad

          public Map<S,Vector> getSubjGrad()

      Returns gradient of subject of recommendation function (unmodifiable).
      Returns:
        Gradient of subject of recommendation function.

    - #### getRows

          public int getRows()

      Returns number of rows the gradient calculated on.
      Returns:
        Number of rows the gradient calculated on.

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023