org.apache.ignite.ml.clustering.gmm

## Class GmmTrainer

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<M,Double>
  - - org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer<GmmModel>
    - - org.apache.ignite.ml.clustering.gmm.GmmTrainer

-     public class GmmTrainer
      extends SingleLabelDatasetTrainer<GmmModel>

  Traner for GMM model.

- - ### Nested Class Summary

    - ### 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
    `GmmTrainer()` Creates an instance of GmmTrainer.
    `GmmTrainer(int countOfComponents)` Creates an instance of GmmTrainer.
    `GmmTrainer(int countOfComponents, int maxCountOfIterations)` Creates an instance of GmmTrainer.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,V> GmmModel` | `fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Trains model based on the specified data.
    `boolean` | `isUpdateable(GmmModel mdl)`
    `protected <K,V> GmmModel` | `updateModel(GmmModel 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.
    `GmmTrainer` | `withEps(double eps)` Sets min divergence beween iterations.
    `GmmTrainer` | `withInitialCountOfComponents(int numberOfComponents)` Sets numberOfComponents.
    `GmmTrainer` | `withInitialMeans(List<Vector> means)` Sets initial means.
    `GmmTrainer` | `withMaxCountIterations(int maxCountOfIterations)` Sets max count of iterations
    `GmmTrainer` | `withMaxCountOfClusters(int maxCountOfClusters)` Sets maximum number of clusters in GMM.
    `GmmTrainer` | `withMaxCountOfInitTries(int maxCountOfInitTries)` Sets MaxCountOfInitTries parameter.
    `GmmTrainer` | `withMaxLikelihoodDivergence(double maxLikelihoodDivergence)` Sets maximum divergence between maximum of likelihood of vector in dataset and other for anomalies identification.
    `GmmTrainer` | `withMinClusterProbability(double minClusterProbability)` Sets minimum requred probability for cluster.
    `GmmTrainer` | `withMinElementsForNewCluster(int minElementsForNewCluster)` Sets minimum required anomalies in terms of maxLikelihoodDivergence for creating new cluster.

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

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

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

- - ### Constructor Detail

    - #### GmmTrainer

          public GmmTrainer()

      Creates an instance of GmmTrainer.

    - #### GmmTrainer

          public GmmTrainer(int countOfComponents,
                            int maxCountOfIterations)

      Creates an instance of GmmTrainer.
      Parameters:
        `countOfComponents` - Count of components.
        `maxCountOfIterations` - Max count of iterations.

    - #### GmmTrainer

          public GmmTrainer(int countOfComponents)

      Creates an instance of GmmTrainer.
      Parameters:
        `countOfComponents` - Count of components.

  - ### Method Detail

    - #### fitWithInitializedDeployingContext

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

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

    - #### withInitialCountOfComponents

          public GmmTrainer withInitialCountOfComponents(int numberOfComponents)

      Sets numberOfComponents.
      Parameters:
        `numberOfComponents` - Number of components.
      Returns:
        Trainer.

    - #### withInitialMeans

          public GmmTrainer withInitialMeans(List<Vector> means)

      Sets initial means.
      Parameters:
        `means` - Initial means for clusters.
      Returns:
        Trainer.

    - #### withMaxCountIterations

          public GmmTrainer withMaxCountIterations(int maxCountOfIterations)

      Sets max count of iterations
      Parameters:
        `maxCountOfIterations` - Max count of iterations.
      Returns:
        Trainer.

    - #### withEps

          public GmmTrainer withEps(double eps)

      Sets min divergence beween iterations.
      Parameters:
        `eps` - Eps.
      Returns:
        Trainer.

    - #### withMaxCountOfInitTries

          public GmmTrainer withMaxCountOfInitTries(int maxCountOfInitTries)

      Sets MaxCountOfInitTries parameter. If means initialization were unsuccessful then algorithm try to reinitialize means randomly MaxCountOfInitTries times.
      Parameters:
        `maxCountOfInitTries` - Max count of init tries.
      Returns:
        Trainer.

    - #### withMaxCountOfClusters

          public GmmTrainer withMaxCountOfClusters(int maxCountOfClusters)

      Sets maximum number of clusters in GMM.
      Parameters:
        `maxCountOfClusters` - Max count of clusters.
      Returns:
        Trainer.

    - #### withMaxLikelihoodDivergence

          public GmmTrainer withMaxLikelihoodDivergence(double maxLikelihoodDivergence)

      Sets maximum divergence between maximum of likelihood of vector in dataset and other for anomalies identification.
      Parameters:
        `maxLikelihoodDivergence` - Max likelihood divergence.
      Returns:
        Trainer.

    - #### withMinElementsForNewCluster

          public GmmTrainer withMinElementsForNewCluster(int minElementsForNewCluster)

      Sets minimum required anomalies in terms of maxLikelihoodDivergence for creating new cluster.
      Parameters:
        `minElementsForNewCluster` - Min elements for new cluster.
      Returns:
        Trainer.

    - #### withMinClusterProbability

          public GmmTrainer withMinClusterProbability(double minClusterProbability)

      Sets minimum requred probability for cluster. If cluster has probability value less than this value then this cluster will be eliminated.
      Parameters:
        `minClusterProbability` - Min cluster probability.
      Returns:
        Trainer.

    - #### isUpdateable

          public boolean isUpdateable(GmmModel mdl)

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

    - #### updateModel

          protected <K,V> GmmModel updateModel(GmmModel 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<GmmModel,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.

2022 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.12.0
Release Date | : January 10 2022