org.apache.ignite.ml.knn.ann

## Class ANNClassificationTrainer

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<M,Double>
  - - org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer<ANNClassificationModel>
    - - org.apache.ignite.ml.knn.ann.ANNClassificationTrainer

-     public class ANNClassificationTrainer
      extends SingleLabelDatasetTrainer<ANNClassificationModel>

  ANN algorithm trainer to solve multi-class classification task. This trainer is based on ACD strategy and KMeans clustering algorithm to find centroids.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ANNClassificationTrainer.CentroidStat` Service class used for statistics.

    - ### Nested classes/interfaces inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `DatasetTrainer.EmptyDatasetException`

  - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `envBuilder, environment`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ANNClassificationTrainer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,V> ANNClassificationModel` | `fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Trains model based on the specified data.
    `DistanceMeasure` | `getDistance()` Gets the distance.
    `double` | `getEpsilon()` Gets the epsilon.
    `int` | `getK()` Gets the amount of clusters.
    `int` | `getMaxIterations()` Gets the max number of iterations before convergence.
    `boolean` | `isUpdateable(ANNClassificationModel mdl)`
    `protected <K,V> ANNClassificationModel` | `updateModel(ANNClassificationModel mdl, DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Gets state of model in arguments, update in according to new data and return new model.
    `ANNClassificationTrainer` | `withDistance(DistanceMeasure distance)` Set up the distance.
    `ANNClassificationTrainer` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Changes learning Environment.
    `ANNClassificationTrainer` | `withEpsilon(double epsilon)` Set up the epsilon.
    `ANNClassificationTrainer` | `withK(int k)` Set up the amount of clusters.
    `ANNClassificationTrainer` | `withMaxIterations(int maxIterations)` Set up the max number of iterations before convergence.

    - ### Methods inherited from class org.apache.ignite.ml.trainers.DatasetTrainer

      `fit, fit, fit, fit, fit, fit, getLastTrainedModelOrThrowEmptyDatasetException, identityTrainer, learningEnvironment, update, update, update, update, update, withConvertedLabels`

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

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

- - ### Constructor Detail

    - #### ANNClassificationTrainer

          public ANNClassificationTrainer()

  - ### Method Detail

    - #### fitWithInitializedDeployingContext

          public <K,V> ANNClassificationModel fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder,
                                                                                 Preprocessor<K,V> extractor)

      Trains model based on the specified data.
      Specified by:
        `fitWithInitializedDeployingContext` in class `DatasetTrainer<ANNClassificationModel,Double>`
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `datasetBuilder` - Dataset builder.
        `extractor` - Mapping from upstream entry to `LabeledVector`.
      Returns:
        Model.

    - #### updateModel

          protected <K,V> ANNClassificationModel updateModel(ANNClassificationModel mdl,
                                                             DatasetBuilder<K,V> datasetBuilder,
                                                             Preprocessor<K,V> extractor)

      Gets state of model in arguments, update in according to new data and return new model.
      Specified by:
        `updateModel` in class `DatasetTrainer<ANNClassificationModel,Double>`
      Type Parameters:
        `K` - Type of a key in `upstream` data.
        `V` - Type of a value in `upstream` data.
      Parameters:
        `mdl` - Learned model.
        `datasetBuilder` - Dataset builder.
        `extractor` - Extractor of `UpstreamEntry` into `LabeledVector`.
      Returns:
        Updated model.

    - #### isUpdateable

          public boolean isUpdateable(ANNClassificationModel mdl)

      Specified by:
        `isUpdateable` in class `DatasetTrainer<ANNClassificationModel,Double>`
      Parameters:
        `mdl` - Model.
      Returns:
        True if current critical for training parameters correspond to parameters from last training.

    - #### withEnvironmentBuilder

          public ANNClassificationTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)

      Changes learning Environment.
      Overrides:
        `withEnvironmentBuilder` in class `DatasetTrainer<ANNClassificationModel,Double>`
      Parameters:
        `envBuilder` - Learning environment builder.

    - #### getK

          public int getK()

      Gets the amount of clusters.
      Returns:
        The parameter value.

    - #### withK

          public ANNClassificationTrainer withK(int k)

      Set up the amount of clusters.
      Parameters:
        `k` - The parameter value.
      Returns:
        Model with new amount of clusters parameter value.

    - #### getMaxIterations

          public int getMaxIterations()

      Gets the max number of iterations before convergence.
      Returns:
        The parameter value.

    - #### withMaxIterations

          public ANNClassificationTrainer withMaxIterations(int maxIterations)

      Set up the max number of iterations before convergence.
      Parameters:
        `maxIterations` - The parameter value.
      Returns:
        Model with new max number of iterations before convergence parameter value.

    - #### getEpsilon

          public double getEpsilon()

      Gets the epsilon.
      Returns:
        The parameter value.

    - #### withEpsilon

          public ANNClassificationTrainer withEpsilon(double epsilon)

      Set up the epsilon.
      Parameters:
        `epsilon` - The parameter value.
      Returns:
        Model with new epsilon parameter value.

    - #### getDistance

          public DistanceMeasure getDistance()

      Gets the distance.
      Returns:
        The parameter value.

    - #### withDistance

          public ANNClassificationTrainer withDistance(DistanceMeasure distance)

      Set up the distance.
      Parameters:
        `distance` - The parameter value.
      Returns:
        Model with new distance parameter value.

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