org.apache.ignite.ml.recommendation

## Class RecommendationTrainer

- java.lang.Object
- - org.apache.ignite.ml.recommendation.RecommendationTrainer

-     public class RecommendationTrainer
      extends Object

  Trainer of the recommendation system.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RecommendationTrainer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,O extends Serializable,S extends Serializable> RecommendationModel<O,S>` | `fit(DatasetBuilder<K,? extends ObjectSubjectRatingTriplet<O,S>> datasetBuilder)` Fits prediction model.
    `RecommendationModel<Serializable,Serializable>` | `fit(DatasetBuilder<Object,BinaryObject> datasetBuilder, String objFieldName, String subjFieldName, String ratingFieldName)` Fits prediction model on a data stored in binary format.
    `<K,O extends Serializable,S extends Serializable> RecommendationModel<O,S>` | `update(DatasetBuilder<K,? extends ObjectSubjectRatingTriplet<O,S>> datasetBuilder, RecommendationModel<O,S> mdl)` Fits prediction model.
    `RecommendationModel<Serializable,Serializable>` | `update(DatasetBuilder<Object,BinaryObject> datasetBuilder, String objFieldName, String subjFieldName, String ratingFieldName, RecommendationModel<Serializable,Serializable> mdl)` Updates prediction model on a data stored in binary format.
    `RecommendationTrainer` | `withBatchSize(int batchSize)` Set up batch size parameter.
    `RecommendationTrainer` | `withK(int k)` Set up `k` parameter (number of rows/cols in matrices after factorization).
    `RecommendationTrainer` | `withLearningEnvironmentBuilder(LearningEnvironmentBuilder environmentBuilder)` Set up learning environment builder.
    `RecommendationTrainer` | `withLearningRate(double learningRate)` Set up learning rate parameter.
    `RecommendationTrainer` | `withMaxIterations(int maxIterations)` Set up max iterations parameter.
    `RecommendationTrainer` | `withMinMdlImprovement(double minMdlImprovement)` Set up `minModelImprovement` parameter (minimal improvement of the model to continue training).
    `RecommendationTrainer` | `withRegularization(double regParam)` Set up regularization parameter.
    `RecommendationTrainer` | `withTrainerEnvironment(LearningEnvironment trainerEnvironment)` Set up trainer learning environment.

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

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

- - ### Constructor Detail

    - #### RecommendationTrainer

          public RecommendationTrainer()

  - ### Method Detail

    - #### fit

          public RecommendationModel<Serializable,Serializable> fit(DatasetBuilder<Object,BinaryObject> datasetBuilder,
                                                                    String objFieldName,
                                                                    String subjFieldName,
                                                                    String ratingFieldName)

      Fits prediction model on a data stored in binary format.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `objFieldName` - Object field name.
        `subjFieldName` - Subject field name.
        `ratingFieldName` - Rating field name.
      Returns:
        Trained recommendation model.

    - #### update

          public RecommendationModel<Serializable,Serializable> update(DatasetBuilder<Object,BinaryObject> datasetBuilder,
                                                                       String objFieldName,
                                                                       String subjFieldName,
                                                                       String ratingFieldName,
                                                                       RecommendationModel<Serializable,Serializable> mdl)

      Updates prediction model on a data stored in binary format.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `objFieldName` - Object field name.
        `subjFieldName` - Subject field name.
        `ratingFieldName` - Rating field name.
        `mdl` - Previous model.
      Returns:
        Trained recommendation model.

    - #### fit

          public <K,O extends Serializable,S extends Serializable> RecommendationModel<O,S> fit(DatasetBuilder<K,? extends ObjectSubjectRatingTriplet<O,S>> datasetBuilder)

      Fits prediction model.
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `O` - Type of an object.
        `S` - Type of a subject.
      Parameters:
        `datasetBuilder` - Dataset builder.
      Returns:
        Trained recommendation model.

    - #### update

          public <K,O extends Serializable,S extends Serializable> RecommendationModel<O,S> update(DatasetBuilder<K,? extends ObjectSubjectRatingTriplet<O,S>> datasetBuilder,
                                                                                                   RecommendationModel<O,S> mdl)

      Fits prediction model.
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `O` - Type of an object.
        `S` - Type of a subject.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `mdl` - Previous model.
      Returns:
        Trained recommendation model.

    - #### withLearningEnvironmentBuilder

          public RecommendationTrainer withLearningEnvironmentBuilder(LearningEnvironmentBuilder environmentBuilder)

      Set up learning environment builder.
      Parameters:
        `environmentBuilder` - Learning environment builder.
      Returns:
        This object.

    - #### withTrainerEnvironment

          public RecommendationTrainer withTrainerEnvironment(LearningEnvironment trainerEnvironment)

      Set up trainer learning environment.
      Parameters:
        `trainerEnvironment` - Trainer learning environment.
      Returns:
        This object.

    - #### withBatchSize

          public RecommendationTrainer withBatchSize(int batchSize)

      Set up batch size parameter.
      Parameters:
        `batchSize` - Batch size of stochastic gradient descent. The size of a dataset used on each step of SGD.
      Returns:
        This object.

    - #### withRegularization

          public RecommendationTrainer withRegularization(double regParam)

      Set up regularization parameter.
      Parameters:
        `regParam` - Regularization parameter.
      Returns:
        This object.

    - #### withLearningRate

          public RecommendationTrainer withLearningRate(double learningRate)

      Set up learning rate parameter.
      Parameters:
        `learningRate` - Learning rate.
      Returns:
        This object.

    - #### withMaxIterations

          public RecommendationTrainer withMaxIterations(int maxIterations)

      Set up max iterations parameter.
      Parameters:
        `maxIterations` - Max iterations.
      Returns:
        This object.

    - #### withMinMdlImprovement

          public RecommendationTrainer withMinMdlImprovement(double minMdlImprovement)

      Set up `minModelImprovement` parameter (minimal improvement of the model to continue training).
      Parameters:
        `minMdlImprovement` - Minimal improvement of the model to continue training.
      Returns:
        This object.

    - #### withK

          public RecommendationTrainer withK(int k)

      Set up `k` parameter (number of rows/cols in matrices after factorization).
      Parameters:
        `k` - Number of rows/cols in matrices after factorization
      Returns:
        This object.

2020 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.9.0
Release Date | : October 15 2020