org.apache.ignite.ml.preprocessing.encoding.onehotencoder

## Class OneHotEncoderPreprocessor<K,V>

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

- Type Parameters:
    `K` - Type of a key in `upstream` data.
    `V` - Type of a value in `upstream` data.
  All Implemented Interfaces:
    Serializable, BiFunction<K,V,LabeledVector>, DeployableObject, IgniteBiFunction<K,V,LabeledVector>, Preprocessor<K,V>

      public final class OneHotEncoderPreprocessor<K,V>
      extends EncoderPreprocessor<K,V>
      implements DeployableObject

  Preprocessing function that makes one-hot encoding. One-hot encoding maps a categorical feature, represented as a label index (Double or String value), to a binary vector with at most a single one-value indicating the presence of a specific feature value from among the set of all feature values. This preprocessor can transform multiple columns which indices are handled during training process. Each one-hot encoded binary vector adds its cells to the end of the current feature vector according the order of handled categorial features.
  See Also:
    `This prerpocessor always creates separate column for the NULL values. NOTE: the index value associated with NULL will located in binary vector according the frequency of NULL values.`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.ml.preprocessing.encoding.EncoderPreprocessor

      `basePreprocessor, encodingValues, handledIndices, KEY_FOR_NULL_VALUES, labelFrequencies`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OneHotEncoderPreprocessor(Map<String,Integer>[] encodingValues, Preprocessor<K,V> basePreprocessor, Set<Integer> handledIndices)` Constructs a new instance of One Hot Encoder preprocessor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `LabeledVector` | `apply(K k, V v)` Applies this preprocessor.
    `List<Object>` | `getDependencies()` Returns dependencies of this object that can be object with class defined by client side and unknown for server.

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

      `map`

    - ### Methods inherited from interface org.apache.ignite.ml.math.functions.IgniteBiFunction

      `andThen`

    - ### Methods inherited from interface java.util.function.BiFunction

      `andThen`

- - ### Constructor Detail

    - #### OneHotEncoderPreprocessor

          public OneHotEncoderPreprocessor(Map<String,Integer>[] encodingValues,
                                           Preprocessor<K,V> basePreprocessor,
                                           Set<Integer> handledIndices)

      Constructs a new instance of One Hot Encoder preprocessor.
      Parameters:
        `basePreprocessor` - Base preprocessor.
        `handledIndices` - Handled indices.

  - ### Method Detail

    - #### apply

          public LabeledVector apply(K k,
                                     V v)

      Applies this preprocessor.
      Specified by:
        `apply` in interface `BiFunction<K,V,LabeledVector>`
      Parameters:
        `k` - Key.
        `v` - Value.
      Returns:
        Preprocessed row.

    - #### getDependencies

          public List<Object> getDependencies()

      Returns dependencies of this object that can be object with class defined by client side and unknown for server.
      Specified by:
        `getDependencies` in interface `DeployableObject`

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