org.apache.ignite.ml.composition.stacking

## Class StackedVectorDatasetTrainer<O,AM extends IgniteModel<Vector,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<Vector,O,AM,L>
      - - org.apache.ignite.ml.composition.stacking.StackedVectorDatasetTrainer<O,AM,L>

- Type Parameters:
    `O` - Type of aggregator model output.
    `L` - Type of labels.
    `AM` - Type of aggregator model.

      public class StackedVectorDatasetTrainer<O,AM extends IgniteModel<Vector,O>,L>
      extends SimpleStackedDatasetTrainer<Vector,O,AM,L>

  `StackedDatasetTrainer` with `Vector` as submodels input and output.

- - ### 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
    `StackedVectorDatasetTrainer()` Constructs instance of this class.
    `StackedVectorDatasetTrainer(DatasetTrainer<AM,L> aggregatingTrainer)` Constructs instance of this class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<M1 extends IgniteModel<Matrix,Matrix>> StackedVectorDatasetTrainer<O,AM,L>` | `addMatrix2MatrixTrainer(DatasetTrainer<M1,L> trainer)` Shortcut for adding trainer `Matrix -> Matrix` where this trainer is treated as `Vector -> Vector`, where input `Vector` is turned into `1 x cols` `Matrix` and output is a first row of output `Matrix`.
    `<M1 extends IgniteModel<Vector,Vector>> StackedVectorDatasetTrainer<O,AM,L>` | `addTrainer(DatasetTrainer<M1,L> trainer)` Adds submodel trainer along with converters needed on training and inference stages.
    `<M1 extends IgniteModel<Vector,Double>> StackedVectorDatasetTrainer<O,AM,L>` | `addTrainerWithDoubleOutput(DatasetTrainer<M1,L> trainer)` Shortcut for adding trainer `Vector -> Double` where this trainer is treated as `Vector -> Vector`, where output `Vector` is constructed by wrapping double value.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withAggregatorInputMerger(IgniteBinaryOperator<Vector> merger)` Specify binary operator used to merge submodels outputs to one.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withAggregatorTrainer(DatasetTrainer<AM,L> aggregatorTrainer)` Specify aggregator trainer.
    `<L1> StackedVectorDatasetTrainer<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.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Changes learning Environment.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withOriginalFeaturesDropped()` Drop original features during training and inference.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withOriginalFeaturesKept()` Keep original features using `IgniteFunction.identity()` as submodelInput2AggregatingInputConverter.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withOriginalFeaturesKept(IgniteFunction<Vector,Vector> submodelInput2AggregatingInputConverter)` Keep original features during training and propagate submodels input to aggregator during inference using given function.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withSubmodelOutput2VectorConverter(IgniteFunction<Vector,Vector> submodelOutput2VectorConverter)` Set function used for conversion of submodel output to `Vector`.
    `StackedVectorDatasetTrainer<O,AM,L>` | `withVector2SubmodelInputConverter(IgniteFunction<Vector,Vector> vector2SubmodelInputConverter)` Set function used for conversion of `Vector` to submodel input.

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

      `fitWithInitializedDeployingContext, isUpdateable, update, updateModel`

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

    - #### StackedVectorDatasetTrainer

          public StackedVectorDatasetTrainer(DatasetTrainer<AM,L> aggregatingTrainer)

      Constructs instance of this class.
      Parameters:
        `aggregatingTrainer` - Aggregator trainer.

    - #### StackedVectorDatasetTrainer

          public StackedVectorDatasetTrainer()

      Constructs instance of this class.

  - ### Method Detail

    - #### addTrainer

          public <M1 extends IgniteModel<Vector,Vector>> StackedVectorDatasetTrainer<O,AM,L> addTrainer(DatasetTrainer<M1,L> trainer)

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

    - #### withAggregatorTrainer

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

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

    - #### withOriginalFeaturesKept

          public StackedVectorDatasetTrainer<O,AM,L> withOriginalFeaturesKept()

      Keep original features using `IgniteFunction.identity()` as submodelInput2AggregatingInputConverter.
      Overrides:
        `withOriginalFeaturesKept` in class `SimpleStackedDatasetTrainer<Vector,O,AM extends IgniteModel<Vector,O>,L>`
      Returns:
        This object.

    - #### withOriginalFeaturesDropped

          public StackedVectorDatasetTrainer<O,AM,L> withOriginalFeaturesDropped()

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

    - #### withOriginalFeaturesKept

          public StackedVectorDatasetTrainer<O,AM,L> withOriginalFeaturesKept(IgniteFunction<Vector,Vector> 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 `SimpleStackedDatasetTrainer<Vector,O,AM extends IgniteModel<Vector,O>,L>`
      Parameters:
        `submodelInput2AggregatingInputConverter` - Function used to propagate submodels input to aggregator.
      Returns:
        This object.

    - #### withSubmodelOutput2VectorConverter

          public StackedVectorDatasetTrainer<O,AM,L> withSubmodelOutput2VectorConverter(IgniteFunction<Vector,Vector> submodelOutput2VectorConverter)

      Set function used for conversion of submodel output to `Vector`. This function is used during building of dataset for training aggregator model. This dataset is augmented with results of submodels converted to `Vector`.
      Overrides:
        `withSubmodelOutput2VectorConverter` in class `StackedDatasetTrainer<Vector,Vector,O,AM extends IgniteModel<Vector,O>,L>`
      Parameters:
        `submodelOutput2VectorConverter` - Function used for conversion of submodel output to `Vector`.
      Returns:
        This object.

    - #### withVector2SubmodelInputConverter

          public StackedVectorDatasetTrainer<O,AM,L> withVector2SubmodelInputConverter(IgniteFunction<Vector,Vector> vector2SubmodelInputConverter)

      Set function used for conversion of `Vector` to submodel input. This function is used during building of dataset for training aggregator model. This dataset is augmented with results of submodels applied to `Vector`s in original dataset.
      Overrides:
        `withVector2SubmodelInputConverter` in class `StackedDatasetTrainer<Vector,Vector,O,AM extends IgniteModel<Vector,O>,L>`
      Parameters:
        `vector2SubmodelInputConverter` - Function used for conversion of `Vector` to submodel input.
      Returns:
        This object.

    - #### withAggregatorInputMerger

          public StackedVectorDatasetTrainer<O,AM,L> withAggregatorInputMerger(IgniteBinaryOperator<Vector> merger)

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

    - #### withEnvironmentBuilder

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

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

    - #### withConvertedLabels

          public <L1> StackedVectorDatasetTrainer<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 `SimpleStackedDatasetTrainer<Vector,O,AM extends IgniteModel<Vector,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.

    - #### addTrainerWithDoubleOutput

          public <M1 extends IgniteModel<Vector,Double>> StackedVectorDatasetTrainer<O,AM,L> addTrainerWithDoubleOutput(DatasetTrainer<M1,L> trainer)

      Shortcut for adding trainer `Vector -> Double` where this trainer is treated as `Vector -> Vector`, where output `Vector` is constructed by wrapping double value.
      Type Parameters:
        `M1` - Type of submodel trainer model.
      Parameters:
        `trainer` - Submodel trainer.
      Returns:
        This object.

    - #### addMatrix2MatrixTrainer

          public <M1 extends IgniteModel<Matrix,Matrix>> StackedVectorDatasetTrainer<O,AM,L> addMatrix2MatrixTrainer(DatasetTrainer<M1,L> trainer)

      Shortcut for adding trainer `Matrix -> Matrix` where this trainer is treated as `Vector -> Vector`, where input `Vector` is turned into `1 x cols` `Matrix` and output is a first row of output `Matrix`.
      Type Parameters:
        `M1` - Type of submodel trainer model.
      Parameters:
        `trainer` - Submodel trainer.
      Returns:
        This object.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021