org.apache.ignite.ml.recommendation.util

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

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

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

      public class RecommendationDatasetData<O extends Serializable,S extends Serializable>
      extends Object
      implements AutoCloseable

  A partition `data` of a dataset required in `RecommendationTrainer`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecommendationDatasetData(List<? extends ObjectSubjectRatingTriplet<O,S>> ratings)` Constructs a new instance of recommendation dataset data.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MatrixFactorizationGradient<O,S>` | `calculateGradient(Map<O,Vector> objMatrix, Map<S,Vector> subjMatrix, int batchSize, int seed, double regParam, double learningRate)` Calculates gradient of the loss function of recommendation system SGD training.
    `void` | `close()`
    `Set<O>` | `getObjects()` Returns set of objects contained in `ratings`.
    `Set<S>` | `getSubjects()` Returns set of subjects contained in `ratings`.

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

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

- - ### Constructor Detail

    - #### RecommendationDatasetData

          public RecommendationDatasetData(List<? extends ObjectSubjectRatingTriplet<O,S>> ratings)

      Constructs a new instance of recommendation dataset data.
      Parameters:
        `ratings` - All ratings related to the partition.

  - ### Method Detail

    - #### calculateGradient

          public MatrixFactorizationGradient<O,S> calculateGradient(Map<O,Vector> objMatrix,
                                                                    Map<S,Vector> subjMatrix,
                                                                    int batchSize,
                                                                    int seed,
                                                                    double regParam,
                                                                    double learningRate)

      Calculates gradient of the loss function of recommendation system SGD training. The details about gradient calculation could be found here: https://tinyurl.com/y6cku9hr.
      Parameters:
        `objMatrix` - Object matrix obtained as a result of factorization of rating matrix.
        `subjMatrix` - Subject matrix obtained as a result of factorization of rating matrix.
        `batchSize` - Batch size of stochastic gradient descent. The size of a dataset used on each step of SGD.
        `seed` - Seed (required to make randomized part behaviour repeatable).
        `regParam` - Regularization parameter.
        `learningRate` - Learning rate.
      Returns:
        Gradient of matrix factorization loss function.

    - #### getObjects

          public Set<O> getObjects()

      Returns set of objects contained in `ratings`.
      Returns:
        Set of object.

    - #### getSubjects

          public Set<S> getSubjects()

      Returns set of subjects contained in `ratings`.
      Returns:
        Set of subjects.

    - #### close

          public void close()

      Specified by:
        `close` in interface `AutoCloseable`

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020