org.apache.ignite.ml.preprocessing.encoding

## Class EncoderTrainer<K,V>

- java.lang.Object
- - org.apache.ignite.ml.preprocessing.encoding.EncoderTrainer<K,V>

- Type Parameters:
    `K` - Type of a key in `upstream` data.
    `V` - Type of a value in `upstream` data.
  All Implemented Interfaces:
    PreprocessingTrainer<K,V>

      public class EncoderTrainer<K,V>
      extends Object
      implements PreprocessingTrainer<K,V>

  Trainer of the String Encoder and One-Hot Encoder preprocessors.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EncoderTrainer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `EncoderPreprocessor<K,V>` | `fit(LearningEnvironmentBuilder envBuilder, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> basePreprocessor)` Fits preprocessor.
    `EncoderTrainer<K,V>` | `labeled(Integer targetLabelIndex)` Sets the target label index.
    `EncoderTrainer<K,V>` | `minCategorySize(Long minCategorySize)` Sets the min category size for category target encoding.
    `EncoderTrainer<K,V>` | `minSamplesLeaf(Integer minSamplesLeaf)` Sets the minSamplesLeaf for target encoding.
    `EncoderTrainer<K,V>` | `smoothing(Double smoothing)` Sets the smoothing for target encoding.
    `EncoderTrainer<K,V>` | `withEncodedFeature(int idx)` Add the index of encoded feature.
    `EncoderTrainer<K,V>` | `withEncodedFeatures(Set<Integer> handledIndices)` Sets the indices of features which should be encoded.
    `EncoderTrainer<K,V>` | `withEncoderIndexingStrategy(EncoderSortingStrategy encoderSortingStgy)` Sets the encoder indexing strategy.
    `EncoderTrainer<K,V>` | `withEncoderType(EncoderType type)` Sets the encoder preprocessor type.

    - ### 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.preprocessing.PreprocessingTrainer

      `fit, fit, fit, fit, fit, learningEnvironment`

- - ### Constructor Detail

    - #### EncoderTrainer

          public EncoderTrainer()

  - ### Method Detail

    - #### fit

          public EncoderPreprocessor<K,V> fit(LearningEnvironmentBuilder envBuilder,
                                              DatasetBuilder<K,V> datasetBuilder,
                                              Preprocessor<K,V> basePreprocessor)

      Fits preprocessor.
      Specified by:
        `fit` in interface `PreprocessingTrainer<K,V>`
      Parameters:
        `envBuilder` - Learning environment builder.
        `datasetBuilder` - Dataset builder.
        `basePreprocessor` - Base preprocessor.
      Returns:
        Preprocessor.

    - #### withEncodedFeature

          public EncoderTrainer<K,V> withEncodedFeature(int idx)

      Add the index of encoded feature.
      Parameters:
        `idx` - The index of encoded feature.
      Returns:
        The changed trainer.

    - #### withEncoderIndexingStrategy

          public EncoderTrainer<K,V> withEncoderIndexingStrategy(EncoderSortingStrategy encoderSortingStgy)

      Sets the encoder indexing strategy.
      Parameters:
        `encoderSortingStgy` - The encoder indexing strategy.
      Returns:
        The changed trainer.

    - #### withEncoderType

          public EncoderTrainer<K,V> withEncoderType(EncoderType type)

      Sets the encoder preprocessor type.
      Parameters:
        `type` - The encoder preprocessor type.
      Returns:
        The changed trainer.

    - #### withEncodedFeatures

          public EncoderTrainer<K,V> withEncodedFeatures(Set<Integer> handledIndices)

      Sets the indices of features which should be encoded.
      Parameters:
        `handledIndices` - Indices of features which should be encoded.
      Returns:
        The changed trainer.

    - #### labeled

          public EncoderTrainer<K,V> labeled(Integer targetLabelIndex)

      Sets the target label index.
      Parameters:
        `targetLabelIndex` - Index of target label.
      Returns:
        The changed trainer.

    - #### smoothing

          public EncoderTrainer<K,V> smoothing(Double smoothing)

      Sets the smoothing for target encoding.
      Parameters:
        `smoothing` - smoothing value.
      Returns:
        The changed trainer.

    - #### minSamplesLeaf

          public EncoderTrainer<K,V> minSamplesLeaf(Integer minSamplesLeaf)

      Sets the minSamplesLeaf for target encoding.
      Parameters:
        `minSamplesLeaf` - min samples leaf.
      Returns:
        The changed trainer.

    - #### minCategorySize

          public EncoderTrainer<K,V> minCategorySize(Long minCategorySize)

      Sets the min category size for category target encoding. Category less then minCategorySize will be encoded with avarage target value.
      Parameters:
        `minCategorySize` - min samples leaf.
      Returns:
        The changed trainer.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.10.0
Release Date | : March 10 2021