org.apache.ignite.ml.dataset.primitive

## Class DatasetWrapper<C extends Serializable,D extends AutoCloseable>

- java.lang.Object
- - org.apache.ignite.ml.dataset.primitive.DatasetWrapper<C,D>

- Type Parameters:
    `C` - Type of a partition `context`.
    `D` - Type of a partition `data`.
  All Implemented Interfaces:
    AutoCloseable, Dataset<C,D>
  Direct Known Subclasses:
    SimpleDataset, SimpleLabeledDataset

      public class DatasetWrapper<C extends Serializable,D extends AutoCloseable>
      extends Object
      implements Dataset<C,D>

  A dataset wrapper that allows to introduce new functionality based on common `compute` methods.
  See Also:
    `SimpleDataset`, `SimpleLabeledDataset`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Dataset<C,D>` | `delegate` Delegate that performs `compute` actions.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatasetWrapper(Dataset<C,D> delegate)` Constructs a new instance of dataset wrapper that delegates `compute` actions to the actual delegate.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `<R> R` | `compute(IgniteBiFunction<D,LearningEnvironment,R> map, IgniteBinaryOperator<R> reduce, R identity)` Applies the specified `map` function to every partition `data` and `LearningEnvironment` in the dataset and then reduces `map` results to final result by using the `reduce` function.
    `<R> R` | `computeWithCtx(IgniteTriFunction<C,D,LearningEnvironment,R> map, IgniteBinaryOperator<R> reduce, R identity)` Applies the specified `map` function to every partition `data`, `context` and partition index in the dataset and then reduces `map` results to final result by using the `reduce` function.

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

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

    - ### Methods inherited from interface org.apache.ignite.ml.dataset.Dataset

      `compute, compute, compute, compute, compute, computeWithCtx, computeWithCtx, computeWithCtx, computeWithCtx, computeWithCtx, wrap`

- - ### Field Detail

    - #### delegate

          protected final Dataset<C extends Serializable,D extends AutoCloseable> delegate

      Delegate that performs `compute` actions.

  - ### Constructor Detail

    - #### DatasetWrapper

          public DatasetWrapper(Dataset<C,D> delegate)

      Constructs a new instance of dataset wrapper that delegates `compute` actions to the actual delegate.
      Parameters:
        `delegate` - Delegate that performs `compute` actions.

  - ### Method Detail

    - #### computeWithCtx

          public <R> R computeWithCtx(IgniteTriFunction<C,D,LearningEnvironment,R> map,
                                      IgniteBinaryOperator<R> reduce,
                                      R identity)

      Applies the specified `map` function to every partition `data`, `context` and partition index in the dataset and then reduces `map` results to final result by using the `reduce` function.
      Specified by:
        `computeWithCtx` in interface `Dataset<C extends Serializable,D extends AutoCloseable>`
      Type Parameters:
        `R` - Type of a result.
      Parameters:
        `map` - Function applied to every partition `data`, `context` and `LearningEnvironment`.
        `reduce` - Function applied to results of `map` to get final result.
        `identity` - Identity.
      Returns:
        Final result.

    - #### compute

          public <R> R compute(IgniteBiFunction<D,LearningEnvironment,R> map,
                               IgniteBinaryOperator<R> reduce,
                               R identity)

      Applies the specified `map` function to every partition `data` and `LearningEnvironment` in the dataset and then reduces `map` results to final result by using the `reduce` function.
      Specified by:
        `compute` in interface `Dataset<C extends Serializable,D extends AutoCloseable>`
      Type Parameters:
        `R` - Type of a result.
      Parameters:
        `map` - Function applied to every partition `data` and `LearningEnvironment`.
        `reduce` - Function applied to results of `map` to get final result.
        `identity` - Identity.
      Returns:
        Final result.

    - #### close

          public void close()
                     throws Exception

      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `Exception`

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022