org.apache.ignite.ml.naivebayes.compound

## Class CompoundNaiveBayesTrainer

- java.lang.Object
- - org.apache.ignite.ml.trainers.DatasetTrainer<M,Double>
  - - org.apache.ignite.ml.trainers.SingleLabelDatasetTrainer<CompoundNaiveBayesModel>
    - - org.apache.ignite.ml.naivebayes.compound.CompoundNaiveBayesTrainer

-     public class CompoundNaiveBayesTrainer
      extends SingleLabelDatasetTrainer<CompoundNaiveBayesModel>

  Trainer for the compound Naive Bayes classifier model. It uses a model composition of `GaussianNaiveBayesTrainer` and `DiscreteNaiveBayesTrainer`. To distinguish which features with which trainer should be used, each trainer should have a collection of feature ids which should be skipped. It can be set by `#setFeatureIdsToSkip()` method.

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<K,V> CompoundNaiveBayesModel` | `fitWithInitializedDeployingContext(DatasetBuilder<K,V> datasetBuilder, Preprocessor<K,V> extractor)` Trains model based on the specified data.
    `boolean` | `isUpdateable(CompoundNaiveBayesModel mdl)`
    `protected <K,V> CompoundNaiveBayesModel` | `updateModel(CompoundNaiveBayesModel 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.
    `CompoundNaiveBayesTrainer` | `withDiscreteFeatureIdsToSkip(Collection<Integer> discreteFeatureIdsToSkip)` Sets feature ids to skip in discrete Bayes.
    `CompoundNaiveBayesTrainer` | `withDiscreteNaiveBayesTrainer(DiscreteNaiveBayesTrainer discreteNaiveBayesTrainer)` Sets a discrete trainer.
    `CompoundNaiveBayesTrainer` | `withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)` Changes learning Environment.
    `CompoundNaiveBayesTrainer` | `withGaussianFeatureIdsToSkip(Collection<Integer> gaussianFeatureIdsToSkip)` Sets feature ids to skip in Gaussian Bayes.
    `CompoundNaiveBayesTrainer` | `withGaussianNaiveBayesTrainer(GaussianNaiveBayesTrainer gaussianNaiveBayesTrainer)` Sets a gaussian trainer.
    `CompoundNaiveBayesTrainer` | `withPriorProbabilities(double[] priorProbabilities)` Sets prior probabilities.

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

    - #### CompoundNaiveBayesTrainer

          public CompoundNaiveBayesTrainer()

  - ### Method Detail

    - #### fitWithInitializedDeployingContext

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

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

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

    - #### withEnvironmentBuilder

          public CompoundNaiveBayesTrainer withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder)

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

    - #### updateModel

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

    - #### withPriorProbabilities

          public CompoundNaiveBayesTrainer withPriorProbabilities(double[] priorProbabilities)

      Sets prior probabilities.

    - #### withGaussianNaiveBayesTrainer

          public CompoundNaiveBayesTrainer withGaussianNaiveBayesTrainer(GaussianNaiveBayesTrainer gaussianNaiveBayesTrainer)

      Sets a gaussian trainer.

    - #### withDiscreteNaiveBayesTrainer

          public CompoundNaiveBayesTrainer withDiscreteNaiveBayesTrainer(DiscreteNaiveBayesTrainer discreteNaiveBayesTrainer)

      Sets a discrete trainer.

    - #### withGaussianFeatureIdsToSkip

          public CompoundNaiveBayesTrainer withGaussianFeatureIdsToSkip(Collection<Integer> gaussianFeatureIdsToSkip)

      Sets feature ids to skip in Gaussian Bayes.

    - #### withDiscreteFeatureIdsToSkip

          public CompoundNaiveBayesTrainer withDiscreteFeatureIdsToSkip(Collection<Integer> discreteFeatureIdsToSkip)

      Sets feature ids to skip in discrete Bayes.

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