org.apache.ignite.ml.preprocessing.encoding.frequency

## Class FrequencyEncoderPreprocessor<K,V>

- java.lang.Object
- - org.apache.ignite.ml.preprocessing.encoding.EncoderPreprocessor<K,V>
  - - org.apache.ignite.ml.preprocessing.encoding.frequency.FrequencyEncoderPreprocessor<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>, IgniteBiFunction<K,V,LabeledVector>, Preprocessor<K,V>

      public class FrequencyEncoderPreprocessor<K,V>
      extends EncoderPreprocessor<K,V>

  Preprocessing function that makes Frequency encoding. The Frequency Encoder Preprocessor encodes string values (categories) to double values in range [0.0, 1], where the value will be presented as a fraction of all the labels.

  This preprocessor can transform multiple columns which indices are handled during training process. These indexes could be defined via .withEncodedFeature(featureIndex) call.

  NOTE: it does not add new column but change data in-place.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,Double>[]` | `encodingFrequencies` Filling values.
    `protected static long` | `serialVersionUID`

    - ### 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
    `FrequencyEncoderPreprocessor(Map<String,Double>[] encodingFrequencies, Preprocessor<K,V> basePreprocessor, Set<Integer> handledIndices)` Constructs a new instance of Frequency 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.

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

- - ### Field Detail

    - #### serialVersionUID

          protected static final long serialVersionUID

      See Also:
        Constant Field Values

    - #### encodingFrequencies

          protected final Map<String,Double>[] encodingFrequencies

      Filling values.

  - ### Constructor Detail

    - #### FrequencyEncoderPreprocessor

          public FrequencyEncoderPreprocessor(Map<String,Double>[] encodingFrequencies,
                                              Preprocessor<K,V> basePreprocessor,
                                              Set<Integer> handledIndices)

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

  - ### Method Detail

    - #### apply

          public LabeledVector apply(K k,
                                     V v)

      Applies this preprocessor.
      Parameters:
        `k` - Key.
        `v` - Value.
      Returns:
        Preprocessed row.

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