org.apache.ignite.ml.knn

## Class KNNPartitionDataBuilder<K,V>

- java.lang.Object
- - org.apache.ignite.ml.knn.KNNPartitionDataBuilder<K,V>

- Type Parameters:
    `K` - Type of a key in `upstream` data.
    `V` - Type of a value in `upstream` data.
  All Implemented Interfaces:
    Serializable, PartitionDataBuilder<K,V,EmptyContext,SpatialIndex<Double>>

      public class KNNPartitionDataBuilder<K,V>
      extends Object
      implements PartitionDataBuilder<K,V,EmptyContext,SpatialIndex<Double>>

  Partition data builder for KNN algorithms based on `SpatialIndex`.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KNNPartitionDataBuilder(Preprocessor<K,V> preprocessor, SpatialIndexType spatialIdxType, DistanceMeasure distanceMeasure)` Constructs a new instance of KNN partition data builder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SpatialIndex<Double>` | `build(LearningEnvironment env, Iterator<UpstreamEntry<K,V>> upstreamData, long upstreamDataSize, EmptyContext ctx)` Builds a new partition `data` from a partition `upstream` data and partition `context`.

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

      `andThen, build`

- - ### Constructor Detail

    - #### KNNPartitionDataBuilder

          public KNNPartitionDataBuilder(Preprocessor<K,V> preprocessor,
                                         SpatialIndexType spatialIdxType,
                                         DistanceMeasure distanceMeasure)

      Constructs a new instance of KNN partition data builder.
      Parameters:
        `preprocessor` - Data preprocessor.
        `spatialIdxType` - Spatial index type.
        `distanceMeasure` - Distance measure.

  - ### Method Detail

    - #### build

          public SpatialIndex<Double> build(LearningEnvironment env,
                                            Iterator<UpstreamEntry<K,V>> upstreamData,
                                            long upstreamDataSize,
                                            EmptyContext ctx)

      Builds a new partition `data` from a partition `upstream` data and partition `context`. Important: there is no guarantee that there will be no more than one UpstreamEntry with given key, UpstreamEntry should be thought rather as a container saving all data from upstream, but omitting uniqueness constraint. This constraint is omitted to allow upstream data transformers in `DatasetBuilder` replicating entries. For example it can be useful for bootstrapping.
      Specified by:
        `build` in interface `PartitionDataBuilder<K,V,EmptyContext,SpatialIndex<Double>>`
      Parameters:
        `env` - Learning environment.
        `upstreamData` - Partition `upstream` data.
        `upstreamDataSize` - Partition `upstream` data size.
        `ctx` - Partition `context`.
      Returns:
        Partition `data`.

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