org.apache.ignite.ml.composition.stacking

## Class SimpleStackedDatasetTrainer<I,O,AM extends IgniteModel<I,O>,L>

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<StackedModel<IS,IA,O,AM>,L>
  - - org.apache.ignite.ml.composition.stacking.StackedDatasetTrainer<I,I,O,AM,L>
    - - org.apache.ignite.ml.composition.stacking.SimpleStackedDatasetTrainer<I,O,AM,L>

- Type Parameters:
    `I` - Type of submodels input.
    `O` - Type of aggregator model output.
    `AM` - Type of aggregator model.
    `L` - Type of labels.
  Direct Known Subclasses:
    StackedVectorDatasetTrainer

      public class SimpleStackedDatasetTrainer<I,O,AM extends IgniteModel<I,O>,L>
      extends StackedDatasetTrainer<I,I,O,AM,L>

  `DatasetTrainer` with same type of input and output of submodels.

- - ### 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`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleStackedDatasetTrainer()` Constructs instance of this class.
    `SimpleStackedDatasetTrainer(DatasetTrainer<AM,L> aggregatingTrainer, IgniteBinaryOperator<I> aggregatingInputMerger)` Construct instance of this class.
    `SimpleStackedDatasetTrainer(DatasetTrainer<AM,L> aggregatingTrainer, IgniteBinaryOperator<I> aggregatingInputMerger, IgniteFunction<I,I> submodelInput2AggregatingInputConverter, IgniteFunction<Vector,I> vector2SubmodelInputConverter, IgniteFunction<I,Vector> submodelOutput2VectorConverter)` Construct instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<M1 extends IgniteModel<I,I>> SimpleStackedDatasetTrainer<I,O,AM,L>` | `addTrainer(DatasetTrainer<M1,L> trainer)` Adds submodel trainer along with converters needed on training and inference stages.
    `SimpleStackedDatasetTrainer<I,O,AM,L>` | `withAggregatorInputMerger(IgniteBinaryOperator<I> merger)` Specify binary operator used to merge submodels outputs to one.
    `SimpleStackedDatasetTrainer<I,O,AM,L>` | `withAggregatorTrainer(DatasetTrainer<AM,L> aggregatorTrainer)` Specify aggregator trainer.
    `<L1> SimpleStackedDatasetTrainer<I,O,AM,L1>` | `withConvertedLabels(IgniteFunction<L1,L> new2Old)` Creates `DatasetTrainer` with same training logic, but able to accept labels of given new type of labels.
    `SimpleStackedDatasetTrainer<I,O,AM,L>` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Changes learning Environment.
    `SimpleStackedDatasetTrainer<I,O,AM,L>` | `withOriginalFeaturesDropped()` Drop original features during training and inference.
    `SimpleStackedDatasetTrainer<I,O,AM,L>` | `withOriginalFeaturesKept()` Keep original features using `IgniteFunction.identity()` as submodelInput2AggregatingInputConverter.
    `SimpleStackedDatasetTrainer<I,O,AM,L>` | `withOriginalFeaturesKept(IgniteFunction<I,I> submodelInput2AggregatingInputConverter)` Keep original features during training and propagate submodels input to aggregator during inference using given function.

    - ### Methods inherited from class org.apache.ignite.ml.composition.stacking.StackedDatasetTrainer

      `fitWithInitializedDeployingContext, isUpdateable, update, updateModel, withSubmodelOutput2VectorConverter, withVector2SubmodelInputConverter`

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

      `fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update`

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

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

- - ### Constructor Detail

    - #### SimpleStackedDatasetTrainer

          public SimpleStackedDatasetTrainer(DatasetTrainer<AM,L> aggregatingTrainer,
                                             IgniteBinaryOperator<I> aggregatingInputMerger,
                                             IgniteFunction<I,I> submodelInput2AggregatingInputConverter,
                                             IgniteFunction<Vector,I> vector2SubmodelInputConverter,
                                             IgniteFunction<I,Vector> submodelOutput2VectorConverter)

      Construct instance of this class.
      Parameters:
        `aggregatingTrainer` - Aggregator trainer.
        `aggregatingInputMerger` - Function used to merge submodels outputs into one.
        `submodelInput2AggregatingInputConverter` - Function used to convert input of submodel to output of submodel this function is used if user chooses to keep original features.

    - #### SimpleStackedDatasetTrainer

          public SimpleStackedDatasetTrainer(DatasetTrainer<AM,L> aggregatingTrainer,
                                             IgniteBinaryOperator<I> aggregatingInputMerger)

      Construct instance of this class.
      Parameters:
        `aggregatingTrainer` - Aggregator trainer.
        `aggregatingInputMerger` - Function used to merge submodels outputs into one.

    - #### SimpleStackedDatasetTrainer

          public SimpleStackedDatasetTrainer()

      Constructs instance of this class.

  - ### Method Detail

    - #### addTrainer

          public <M1 extends IgniteModel<I,I>> SimpleStackedDatasetTrainer<I,O,AM,L> addTrainer(DatasetTrainer<M1,L> trainer)

      Adds submodel trainer along with converters needed on training and inference stages.
      Overrides:
        `addTrainer` in class `StackedDatasetTrainer<I,I,O,AM extends IgniteModel<I,O>,L>`
      Parameters:
        `trainer` - Submodel trainer.
      Returns:
        This object.

    - #### withAggregatorTrainer

          public SimpleStackedDatasetTrainer<I,O,AM,L> withAggregatorTrainer(DatasetTrainer<AM,L> aggregatorTrainer)

      Specify aggregator trainer.
      Overrides:
        `withAggregatorTrainer` in class `StackedDatasetTrainer<I,I,O,AM extends IgniteModel<I,O>,L>`
      Parameters:
        `aggregatorTrainer` - Aggregator trainer.
      Returns:
        This object.

    - #### withOriginalFeaturesDropped

          public SimpleStackedDatasetTrainer<I,O,AM,L> withOriginalFeaturesDropped()

      Drop original features during training and inference.
      Overrides:
        `withOriginalFeaturesDropped` in class `StackedDatasetTrainer<I,I,O,AM extends IgniteModel<I,O>,L>`
      Returns:
        This object.

    - #### withOriginalFeaturesKept

          public SimpleStackedDatasetTrainer<I,O,AM,L> withOriginalFeaturesKept(IgniteFunction<I,I> submodelInput2AggregatingInputConverter)

      Keep original features during training and propagate submodels input to aggregator during inference using given function. Note that if this object is on, training will be done on vector obtaining from concatenating features passed to submodels trainers and outputs of submodels converted to vectors, this can, for example influence aggregator model input vector dimension (if `IS = Vector`), or, more generally, some `IS` parameters which are not reflected just by its type. So converter should be written accordingly.
      Overrides:
        `withOriginalFeaturesKept` in class `StackedDatasetTrainer<I,I,O,AM extends IgniteModel<I,O>,L>`
      Parameters:
        `submodelInput2AggregatingInputConverter` - Function used to propagate submodels input to aggregator.
      Returns:
        This object.

    - #### withAggregatorInputMerger

          public SimpleStackedDatasetTrainer<I,O,AM,L> withAggregatorInputMerger(IgniteBinaryOperator<I> merger)

      Specify binary operator used to merge submodels outputs to one.
      Overrides:
        `withAggregatorInputMerger` in class `StackedDatasetTrainer<I,I,O,AM extends IgniteModel<I,O>,L>`
      Parameters:
        `merger` - Binary operator used to merge submodels outputs to one.
      Returns:
        This object.

    - #### withEnvironmentBuilder

          public SimpleStackedDatasetTrainer<I,O,AM,L> withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)

      Changes learning Environment.
      Overrides:
        `withEnvironmentBuilder` in class `StackedDatasetTrainer<I,I,O,AM extends IgniteModel<I,O>,L>`
      Parameters:
        `envBuilder` - Learning environment builder.

    - #### withConvertedLabels

          public <L1> SimpleStackedDatasetTrainer<I,O,AM,L1> withConvertedLabels(IgniteFunction<L1,L> new2Old)

      Creates `DatasetTrainer` with same training logic, but able to accept labels of given new type of labels.
      Overrides:
        `withConvertedLabels` in class `DatasetTrainer<StackedModel<I,I,O,AM extends IgniteModel<I,O>>,L>`
      Type Parameters:
        `L1` - New labels type.
      Parameters:
        `new2Old` - Converter of new labels to old labels.
      Returns:
        `DatasetTrainer` with same training logic, but able to accept labels of given new type of labels.

    - #### withOriginalFeaturesKept

          public SimpleStackedDatasetTrainer<I,O,AM,L> withOriginalFeaturesKept()

      Keep original features using `IgniteFunction.identity()` as submodelInput2AggregatingInputConverter.
      Returns:
        This object.

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