org.apache.ignite.ml.trainers

## Class AdaptableDatasetTrainer<I,O,IW,OW,M extends IgniteModel<IW,OW>,L>

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<AdaptableDatasetModel<I,O,IW,OW,M>,L>
  - - org.apache.ignite.ml.trainers.AdaptableDatasetTrainer<I,O,IW,OW,M,L>

- Type Parameters:
    `I` - Input type of model produced by this trainer.
    `O` - Output type of model produced by this trainer.
    `IW` - Input type of model produced by wrapped trainer.
    `OW` - Output type of model produced by wrapped trainer.
    `M` - Type of model produced by wrapped model.
    `L` - Type of labels.

      public class AdaptableDatasetTrainer<I,O,IW,OW,M extends IgniteModel<IW,OW>,L>
      extends DatasetTrainer<AdaptableDatasetModel<I,O,IW,OW,M>,L>

  Type used to adapt input and output types of wrapped `DatasetTrainer`. Produces model which is composition of form `before `andThen` wMdl `andThen` after` where wMdl is model produced by wrapped trainer.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `DatasetTrainer.EmptyDatasetException`

  - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `envBuilder, environment`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AdaptableDatasetTrainer<I,O,IW,OW,M,L>` | `afterFeatureExtractor(IgniteFunction<Vector,Vector> after)` Specify function which will be applied after feature extractor.
    `AdaptableDatasetTrainer<I,O,IW,OW,M,L>` | `afterLabelExtractor(IgniteFunction<L,L> after)` Specify function which will be applied after label extractor.
    `<O1> AdaptableDatasetTrainer<I,O1,IW,OW,M,L>` | `afterTrainedModel(IgniteFunction<O,O1> after)` Let this trainer produce model `mdl`.
    `<O1,M1 extends IgniteModel<O,O1>> TrainersSequentialComposition<I,O,O1,L>` | `andThen(DatasetTrainer<M1,L> tr, IgniteFunction<AdaptableDatasetModel<I,O,IW,OW,M>,IgniteFunction<LabeledVector<L>,LabeledVector<L>>> datasetMappingProducer)` Create a `TrainersSequentialComposition` of this trainer and specified trainer.
    `<I1> AdaptableDatasetTrainer<I1,O,IW,OW,M,L>` | `beforeTrainedModel(IgniteFunction<I1,I> before)` Let this trainer produce model `mdl`.
    `<K,V> AdaptableDatasetModel<I,O,IW,OW,M>` | `fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Trains model based on the specified data.
    `boolean` | `isUpdateable(AdaptableDatasetModel<I,O,IW,OW,M> mdl)`
    `static <I,O,M extends IgniteModel<I,O>,L> AdaptableDatasetTrainer<I,O,I,O,M,L>` | `of(DatasetTrainer<M,L> wrapped)` Construct instance of this class from a given `DatasetTrainer`.
    `protected <K,V> AdaptableDatasetModel<I,O,IW,OW,M>` | `updateModel(AdaptableDatasetModel<I,O,IW,OW,M> mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Gets state of model in arguments, update in according to new data and return new model.
    `AdaptableDatasetTrainer<I,O,IW,OW,M,L>` | `withDatasetMapping(DatasetMapping<L,L> mapping)` Specify `DatasetMapping` which will be applied to dataset before fitting and updating.
    `AdaptableDatasetTrainer<I,O,IW,OW,M,L>` | `withUpstreamTransformerBuilder(UpstreamTransformerBuilder upstreamTransformerBuilder)` Specify which `UpstreamTransformerBuilder` will be used.

    - ### Methods inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels, withEnvironmentBuilder`

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

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

- - ### Method Detail

    - #### of

          public static <I,O,M extends IgniteModel<I,O>,L> AdaptableDatasetTrainer<I,O,I,O,M,L> of(DatasetTrainer<M,L> wrapped)

      Construct instance of this class from a given `DatasetTrainer`.
      Type Parameters:
        `I` - Input type of wrapped trainer.
        `O` - Output type of wrapped trainer.
        `M` - Type of model produced by wrapped trainer.
        `L` - Type of labels.
      Parameters:
        `wrapped` - Wrapped trainer.
      Returns:
        Instance of this class.

    - #### fitWithInitializedDeployingContext

          public <K,V> AdaptableDatasetModel<I,O,IW,OW,M> fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
                                                                                             Preprocessor<K,V> extractor)

      Trains model based on the specified data.
      Specified by:
        `fitWithInitializedDeployingContext` in class `DatasetTrainer<AdaptableDatasetModel<I,O,IW,OW,M extends IgniteModel<IW,OW>>,L>`
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `extractor` - Extractor of `UpstreamEntry` into `LabeledVector`.
      Returns:
        Model.

    - #### isUpdateable

          public boolean isUpdateable(AdaptableDatasetModel<I,O,IW,OW,M> mdl)

      Specified by:
        `isUpdateable` in class `DatasetTrainer<AdaptableDatasetModel<I,O,IW,OW,M extends IgniteModel<IW,OW>>,L>`
      Parameters:
        `mdl` - Model.
      Returns:
        True if current critical for training parameters correspond to parameters from last training.

    - #### updateModel

          protected <K,V> AdaptableDatasetModel<I,O,IW,OW,M> updateModel(AdaptableDatasetModel<I,O,IW,OW,M> mdl,
                                                                         DatasetBuilder<K,V> datasetBuilder,
                                                                         Preprocessor<K,V> extractor)

      Gets state of model in arguments, update in according to new data and return new model.
      Specified by:
        `updateModel` in class `DatasetTrainer<AdaptableDatasetModel<I,O,IW,OW,M extends IgniteModel<IW,OW>>,L>`
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `mdl` - Learned model.
        `datasetBuilder` - Dataset builder.
        `extractor` - Extractor of `UpstreamEntry` into `LabeledVector`.
      Returns:
        Updated model.

    - #### afterTrainedModel

          public <O1> AdaptableDatasetTrainer<I,O1,IW,OW,M,L> afterTrainedModel(IgniteFunction<O,O1> after)

      Let this trainer produce model `mdl`. This method produces a trainer which produces `mdl1`, where `mdl1 = mdl `andThen` after`.
      Type Parameters:
        `O1` - Type of produced model output.
      Parameters:
        `after` - Function inserted before produced model.
      Returns:
        New `DatasetTrainer` which produces composition of specified function and model produced by original trainer.

    - #### beforeTrainedModel

          public <I1> AdaptableDatasetTrainer<I1,O,IW,OW,M,L> beforeTrainedModel(IgniteFunction<I1,I> before)

      Let this trainer produce model `mdl`. This method produces a trainer which produces `mdl1`, where `mdl1 = f `andThen` mdl`.
      Type Parameters:
        `I1` - Type of produced model input.
      Parameters:
        `before` - Function inserted before produced model.
      Returns:
        New `DatasetTrainer` which produces composition of specified function and model produced by original trainer.

    - #### withDatasetMapping

          public AdaptableDatasetTrainer<I,O,IW,OW,M,L> withDatasetMapping(DatasetMapping<L,L> mapping)

      Specify `DatasetMapping` which will be applied to dataset before fitting and updating.
      Parameters:
        `mapping` - `DatasetMapping` which will be applied to dataset before fitting and updating.
      Returns:
        New trainer of the same type, but with specified mapping applied to dataset before fitting and updating.

    - #### andThen

          public <O1,M1 extends IgniteModel<O,O1>> TrainersSequentialComposition<I,O,O1,L> andThen(DatasetTrainer<M1,L> tr,
                                                                                                   IgniteFunction<AdaptableDatasetModel<I,O,IW,OW,M>,IgniteFunction<LabeledVector<L>,LabeledVector<L>>> datasetMappingProducer)

      Create a `TrainersSequentialComposition` of this trainer and specified trainer.
      Type Parameters:
        `O1` - Type of output of trainer to compose with.
        `M1` - Type of model produced by the trainer to compose with.
      Parameters:
        `tr` - Trainer to compose with.
        `datasetMappingProducer` - `DatasetMapping` producer specifying dependency between this trainer and trainer to compose with.
      Returns:
        A `TrainersSequentialComposition` of this trainer and specified trainer.

    - #### afterFeatureExtractor

          public AdaptableDatasetTrainer<I,O,IW,OW,M,L> afterFeatureExtractor(IgniteFunction<Vector,Vector> after)

      Specify function which will be applied after feature extractor.
      Parameters:
        `after` - Function which will be applied after feature extractor.
      Returns:
        New trainer with same parameters as this trainer except that specified function will be applied after feature extractor.

    - #### afterLabelExtractor

          public AdaptableDatasetTrainer<I,O,IW,OW,M,L> afterLabelExtractor(IgniteFunction<L,L> after)

      Specify function which will be applied after label extractor.
      Parameters:
        `after` - Function which will be applied after label extractor.
      Returns:
        New trainer with same parameters as this trainer has except that specified function will be applied after label extractor.

    - #### withUpstreamTransformerBuilder

          public AdaptableDatasetTrainer<I,O,IW,OW,M,L> withUpstreamTransformerBuilder(UpstreamTransformerBuilder upstreamTransformerBuilder)

      Specify which `UpstreamTransformerBuilder` will be used.
      Parameters:
        `upstreamTransformerBuilder` - `UpstreamTransformerBuilder` to use.
      Returns:
        New trainer with same parameters as this trainer has except that specified `UpstreamTransformerBuilder` will be used.

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