org.apache.ignite.ml.naivebayes.gaussian

## Class GaussianNaiveBayesModel

- java.lang.Object
- - org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesModel

- All Implemented Interfaces:
    Serializable, AutoCloseable, DeployableObject, Exportable<GaussianNaiveBayesModel>, IgniteModel<Vector,Double>, JSONWritable, Model<Vector,Double>, BayesModel<GaussianNaiveBayesModel,Vector,Double>

      public class GaussianNaiveBayesModel
      extends Object
      implements BayesModel<GaussianNaiveBayesModel,Vector,Double>, JSONWritable, DeployableObject

  Simple naive Bayes model which predicts result value `y` belongs to a class `C_k, k in [0..K]` as `p(C_k,y) = p(C_k)*p(y_1,C_k) *...*p(y_n,C_k) / p(y)`. Return the number of the most possible class.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GaussianNaiveBayesModel()`
    `GaussianNaiveBayesModel(double[][] means, double[][] variances, double[] classProbabilities, double[] labels, org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder sumsHolder)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static GaussianNaiveBayesModel` | `fromJSON(Path path)` Loads GaussianNaiveBayesModel from JSON file.
    `double[]` | `getClassProbabilities()` A getter for classProbabilities.
    `List<Object>` | `getDependencies()` Returns dependencies of this object that can be object with class defined by client side and unknown for server.
    `double[]` | `getLabels()` A getter for labels.
    `double[][]` | `getMeans()` A getter for means.
    `org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder` | `getSumsHolder()` A getter for sumsHolder.
    `double[][]` | `getVariances()` A getter for variances.
    `Double` | `predict(Vector vector)` Returns a number of class to which the input belongs.
    `double[]` | `probabilityPowers(Vector vector)` Returns an array where the index correapons a label, and value corresponds `log(probability)` to be this label.
    `<P> void` | `saveModel(Exporter<GaussianNaiveBayesModel,P> exporter, P path)` Save model by the given path.
    `void` | `toJSON(Path path)`

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

      `andBefore, andThen, andThen, close, combine, toString`

- - ### Constructor Detail

    - #### GaussianNaiveBayesModel

          public GaussianNaiveBayesModel(double[][] means,
                                         double[][] variances,
                                         double[] classProbabilities,
                                         double[] labels,
                                         org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder sumsHolder)

      Parameters:
        `means` - Means of features for all classes.
        `variances` - Variances of features for all classes.
        `classProbabilities` - Probabilities for all classes.
        `labels` - Labels.
        `sumsHolder` - Feature sum, squared sum and count sum per label. This data is used for future model updating.

    - #### GaussianNaiveBayesModel

          public GaussianNaiveBayesModel()

  - ### Method Detail

    - #### saveModel

          public <P> void saveModel(Exporter<GaussianNaiveBayesModel,P> exporter,
                                    P path)

      Save model by the given path.
      Specified by:
        `saveModel` in interface `Exportable<GaussianNaiveBayesModel>`
      Parameters:
        `exporter` - Exporter.
        `path` - Path to saved model.

    - #### predict

          public Double predict(Vector vector)

      Returns a number of class to which the input belongs.
      Specified by:
        `predict` in interface `Model<Vector,Double>`
      Parameters:
        `vector` - Input arguments.
      Returns:
        Prediction result.

    - #### probabilityPowers

          public double[] probabilityPowers(Vector vector)

      Returns an array where the index correapons a label, and value corresponds `log(probability)` to be this label. The prior probabilities are not count.
      Specified by:
        `probabilityPowers` in interface `BayesModel<GaussianNaiveBayesModel,Vector,Double>`

    - #### getMeans

          public double[][] getMeans()

      A getter for means.

    - #### getVariances

          public double[][] getVariances()

      A getter for variances.

    - #### getClassProbabilities

          public double[] getClassProbabilities()

      A getter for classProbabilities.

    - #### getLabels

          public double[] getLabels()

      A getter for labels.

    - #### getSumsHolder

          public org.apache.ignite.ml.naivebayes.gaussian.GaussianNaiveBayesSumsHolder getSumsHolder()

      A getter for sumsHolder.

    - #### getDependencies

          public List<Object> getDependencies()

      Returns dependencies of this object that can be object with class defined by client side and unknown for server.
      Specified by:
        `getDependencies` in interface `DeployableObject`

    - #### toJSON

          public void toJSON(Path path)

      Specified by:
        `toJSON` in interface `JSONWritable`

    - #### fromJSON

          public static GaussianNaiveBayesModel fromJSON(Path path)

      Loads GaussianNaiveBayesModel from JSON file.

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