org.apache.ignite.ml.naivebayes.gaussian

## Class GaussianNaiveBayesTrainer

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<M,Double>
  - - org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer<GaussianNaiveBayesModel>
    - - org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesTrainer

-     public class GaussianNaiveBayesTrainer
      extends SingleLabelDatasetTrainer<GaussianNaiveBayesModel>

  Trainer for the naive Bayes classification model. The trainer calculates prior probabilities from the input dataset. Prior probabilities can be also set by `setPriorProbabilities` or `withEquiprobableClasses`. If `equiprobableClasses` is set, the probabilities of all classes will be `1/k`, where `k` is classes count.

- - ### 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
    `GaussianNaiveBayesTrainer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,V> GaussianNaiveBayesModel` | `fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Trains model based on the specified data.
    `boolean` | `isUpdateable(GaussianNaiveBayesModel mdl)`
    `GaussianNaiveBayesTrainer` | `resetSettings()` Sets default settings.
    `GaussianNaiveBayesTrainer` | `setPriorProbabilities(double[] priorProbabilities)` Sets prior probabilities.
    `protected <K,V> GaussianNaiveBayesModel` | `updateModel(GaussianNaiveBayesModel 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.
    `GaussianNaiveBayesTrainer` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Changes learning Environment.
    `GaussianNaiveBayesTrainer` | `withEquiprobableClasses()` Sets equal probability for all classes.

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

    - #### GaussianNaiveBayesTrainer

          public GaussianNaiveBayesTrainer()

  - ### Method Detail

    - #### fitWithInitializedDeployingContext

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

      Trains model based on the specified data.
      Specified by:
        `fitWithInitializedDeployingContext` in class `DatasetTrainer<GaussianNaiveBayesModel,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.

    - #### isUpdateable

          public boolean isUpdateable(GaussianNaiveBayesModel mdl)

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

    - #### withEnvironmentBuilder

          public GaussianNaiveBayesTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)

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

    - #### updateModel

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

    - #### withEquiprobableClasses

          public GaussianNaiveBayesTrainer withEquiprobableClasses()

      Sets equal probability for all classes.

    - #### setPriorProbabilities

          public GaussianNaiveBayesTrainer setPriorProbabilities(double[] priorProbabilities)

      Sets prior probabilities.

    - #### resetSettings

          public GaussianNaiveBayesTrainer resetSettings()

      Sets default settings.

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