org.apache.ignite.ml.composition.boosting

## Class GDBLearningStrategy

- java.lang.Object
- - org.apache.ignite.ml.composition.boosting.GDBLearningStrategy

- Direct Known Subclasses:
    GDBOnTreesLearningStrategy

      public class GDBLearningStrategy
      extends Object

  Learning strategy for gradient boosting.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected IgniteSupplier<DatasetTrainer<? extends IgniteModel<Vector,Double>,Double>>` | `baseMdlTrainerBuilder` Base model trainer builder.
    `protected ConvergenceCheckerFactory` | `checkConvergenceStgyFactory` Check convergence strategy factory.
    `protected int` | `cntOfIterations` Count of iterations.
    `protected double[]` | `compositionWeights` Composition weights.
    `protected LearningEnvironmentBuilder` | `envBuilder` Learning environment builder.
    `protected IgniteFunction<Double,Double>` | `externalLbToInternalMapping` External label to internal mapping.
    `protected Loss` | `loss` Loss of gradient.
    `protected double` | `meanLbVal` Mean label value.
    `protected long` | `sampleSize` Sample size.
    `protected LearningEnvironment` | `trainerEnvironment` Learning environment used for trainer.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GDBLearningStrategy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double[]` | `getCompositionWeights()`
    `double` | `getMeanValue()`
    `protected @NotNull List<IgniteModel<Vector,Double>>` | `initLearningState(GDBModel mdlToUpdate)` Restores state of already learned model if can and sets learning parameters according to this state.
    `<K,V> List<IgniteModel<Vector,Double>>` | `learnModels(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)` Implementation of gradient boosting iterations.
    `<K,V> List<IgniteModel<Vector,Double>>` | `update(GDBModel mdlToUpdate, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> preprocessor)` Gets state of model in arguments, compare it with training parameters of trainer and if they are fit then trainer updates model in according to new data and return new model.
    `GDBLearningStrategy` | `withBaseModelTrainerBuilder(IgniteSupplier<DatasetTrainer<? extends IgniteModel<Vector,Double>,Double>> buildBaseMdlTrainer)` Sets base model builder.
    `GDBLearningStrategy` | `withCheckConvergenceStgyFactory(ConvergenceCheckerFactory factory)` Sets CheckConvergenceStgyFactory.
    `GDBLearningStrategy` | `withCntOfIterations(int cntOfIterations)` Sets count of iterations.
    `GDBLearningStrategy` | `withCompositionWeights(double[] compositionWeights)` Sets composition weights vector.
    `GDBLearningStrategy` | `withDefaultGradStepSize(double defaultGradStepSize)` Sets default gradient step size.
    `GDBLearningStrategy` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Sets learning environment.
    `GDBLearningStrategy` | `withExternalLabelToInternal(IgniteFunction<Double,Double> externalLbToInternal)` Sets external to internal label representation mapping.
    `GDBLearningStrategy` | `withLossGradient(Loss loss)` Loss function.
    `GDBLearningStrategy` | `withMeanLabelValue(double meanLbVal)` Sets mean label value.
    `GDBLearningStrategy` | `withSampleSize(long sampleSize)` Sets sample size.

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

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

- - ### Field Detail

    - #### envBuilder

          protected LearningEnvironmentBuilder envBuilder

      Learning environment builder.

    - #### trainerEnvironment

          protected LearningEnvironment trainerEnvironment

      Learning environment used for trainer.

    - #### cntOfIterations

          protected int cntOfIterations

      Count of iterations.

    - #### loss

          protected Loss loss

      Loss of gradient.

    - #### externalLbToInternalMapping

          protected IgniteFunction<Double,Double> externalLbToInternalMapping

      External label to internal mapping.

    - #### baseMdlTrainerBuilder

          protected IgniteSupplier<DatasetTrainer<? extends IgniteModel<Vector,Double>,Double>> baseMdlTrainerBuilder

      Base model trainer builder.

    - #### meanLbVal

          protected double meanLbVal

      Mean label value.

    - #### sampleSize

          protected long sampleSize

      Sample size.

    - #### compositionWeights

          protected double[] compositionWeights

      Composition weights.

    - #### checkConvergenceStgyFactory

          protected ConvergenceCheckerFactory checkConvergenceStgyFactory

      Check convergence strategy factory.

  - ### Constructor Detail

    - #### GDBLearningStrategy

          public GDBLearningStrategy()

  - ### Method Detail

    - #### learnModels

          public <K,V> List<IgniteModel<Vector,Double>> learnModels(DatasetBuilder<K,V> datasetBuilder,
                                                                    Preprocessor<K,V> preprocessor)

      Implementation of gradient boosting iterations. At each step of iterations this algorithm build a regression model based on gradient of loss-function for current models composition.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `preprocessor` - Upstream preprocessor.
      Returns:
        List of learned models.

    - #### update

          public <K,V> List<IgniteModel<Vector,Double>> update(GDBModel mdlToUpdate,
                                                               DatasetBuilder<K,V> datasetBuilder,
                                                               Preprocessor<K,V> preprocessor)

      Gets state of model in arguments, compare it with training parameters of trainer and if they are fit then trainer updates model in according to new data and return new model. In other case trains new model.
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `mdlToUpdate` - Learned model.
        `datasetBuilder` - Dataset builder.
        `preprocessor` - Upstream preprocessor.
      Returns:
        Updated models list.

    - #### initLearningState

          @NotNull
          protected @NotNull List<IgniteModel<Vector,Double>> initLearningState(GDBModel mdlToUpdate)

      Restores state of already learned model if can and sets learning parameters according to this state.
      Parameters:
        `mdlToUpdate` - Model to update.
      Returns:
        List of already learned models.

    - #### withEnvironmentBuilder

          public GDBLearningStrategy withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)

      Sets learning environment.
      Parameters:
        `envBuilder` - Learning Environment.

    - #### withCntOfIterations

          public GDBLearningStrategy withCntOfIterations(int cntOfIterations)

      Sets count of iterations.
      Parameters:
        `cntOfIterations` - Count of iterations.

    - #### withLossGradient

          public GDBLearningStrategy withLossGradient(Loss loss)

      Loss function.
      Parameters:
        `loss` - Loss function.

    - #### withExternalLabelToInternal

          public GDBLearningStrategy withExternalLabelToInternal(IgniteFunction<Double,Double> externalLbToInternal)

      Sets external to internal label representation mapping.
      Parameters:
        `externalLbToInternal` - External label to internal.

    - #### withBaseModelTrainerBuilder

          public GDBLearningStrategy withBaseModelTrainerBuilder(IgniteSupplier<DatasetTrainer<? extends IgniteModel<Vector,Double>,Double>> buildBaseMdlTrainer)

      Sets base model builder.
      Parameters:
        `buildBaseMdlTrainer` - Build base model trainer.

    - #### withMeanLabelValue

          public GDBLearningStrategy withMeanLabelValue(double meanLbVal)

      Sets mean label value.
      Parameters:
        `meanLbVal` - Mean label value.

    - #### withSampleSize

          public GDBLearningStrategy withSampleSize(long sampleSize)

      Sets sample size.
      Parameters:
        `sampleSize` - Sample size.

    - #### withCompositionWeights

          public GDBLearningStrategy withCompositionWeights(double[] compositionWeights)

      Sets composition weights vector.
      Parameters:
        `compositionWeights` - Composition weights.

    - #### withCheckConvergenceStgyFactory

          public GDBLearningStrategy withCheckConvergenceStgyFactory(ConvergenceCheckerFactory factory)

      Sets CheckConvergenceStgyFactory.
      Parameters:
        `factory` - Factory.

    - #### withDefaultGradStepSize

          public GDBLearningStrategy withDefaultGradStepSize(double defaultGradStepSize)

      Sets default gradient step size.
      Parameters:
        `defaultGradStepSize` - Default gradient step size.

    - #### getCompositionWeights

          public double[] getCompositionWeights()

    - #### getMeanValue

          public double getMeanValue()

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022