org.apache.ignite.ml.knn.ann

## Class ANNClassificationModel

- java.lang.Object
- - org.apache.ignite.ml.knn.NNClassificationModel
  - - org.apache.ignite.ml.knn.ann.ANNClassificationModel

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

      public final class ANNClassificationModel
      extends NNClassificationModel
      implements JSONWritable, DeployableObject

  ANN model to predict labels in multi-class classification task.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ANNClassificationModel.ANNJSONExportModel`

  - ### Field Summary

    - ### Fields inherited from class org.apache.ignite.ml.knn.NNClassificationModel

      `distanceMeasure, k, weighted`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ANNClassificationModel(LabeledVectorSet<LabeledVector> centers, ANNClassificationTrainer.CentroidStat centroindsStat)` Build the model based on a candidates set.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `static ANNClassificationModel` | `fromJSON(Path path)` Loads ANNClassificationModel from JSON file.
    `LabeledVectorSet<LabeledVector>` | `getCandidates()`
    `ANNClassificationTrainer.CentroidStat` | `getCentroindsStat()`
    `List<Object>` | `getDependencies()` Returns dependencies of this object that can be object with class defined by client side and unknown for server.
    `int` | `hashCode()`
    `Double` | `predict(Vector v)` Make a prediction for the specified input arguments.
    `<P> void` | `saveModel(Exporter<KNNModelFormat,P> exporter, P path)` Save model by the given path.
    `void` | `toJSON(Path path)`
    `String` | `toString()`
    `String` | `toString(boolean pretty)`

    - ### Methods inherited from class org.apache.ignite.ml.knn.NNClassificationModel

      `buildLabeledDatasetOnListOfVectors, copyParametersFrom, getClassVoteForVector, getClassWithMaxVotes, getDistanceMeasure, getDistances, getK, getKClosestVectors, isWeighted, putDistanceIdxPair, withDistanceMeasure, withK, withWeighted`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.apache.ignite.ml.IgniteModel

      `andBefore, andThen, andThen, close, combine`

- - ### Constructor Detail

    - #### ANNClassificationModel

          public ANNClassificationModel(LabeledVectorSet<LabeledVector> centers,
                                        ANNClassificationTrainer.CentroidStat centroindsStat)

      Build the model based on a candidates set.
      Parameters:
        `centers` - The candidates set.
        `centroindsStat` - The stat about centroids.

  - ### Method Detail

    - #### getCandidates

          public LabeledVectorSet<LabeledVector> getCandidates()

    - #### getCentroindsStat

          public ANNClassificationTrainer.CentroidStat getCentroindsStat()

    - #### predict

          public Double predict(Vector v)

      Make a prediction for the specified input arguments.
      Specified by:
        `predict` in interface `Model<Vector,Double>`
      Parameters:
        `v` - Input arguments.
      Returns:
        Prediction result.

    - #### saveModel

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

      Description copied from class: `NNClassificationModel`
      Save model by the given path.
      Specified by:
        `saveModel` in interface `Exportable<KNNModelFormat>`
      Specified by:
        `saveModel` in class `NNClassificationModel`
      Parameters:
        `exporter` - Exporter.
        `path` - Path to saved model.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `NNClassificationModel`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `NNClassificationModel`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `NNClassificationModel`

    - #### toString

          public String toString(boolean pretty)

      Specified by:
        `toString` in interface `IgniteModel<Vector,Double>`
      Overrides:
        `toString` in class `NNClassificationModel`
      Parameters:
        `pretty` - Use pretty mode.

    - #### 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`
      Overrides:
        `getDependencies` in class `NNClassificationModel`

    - #### fromJSON

          public static ANNClassificationModel fromJSON(Path path)

      Loads ANNClassificationModel from JSON file.

    - #### toJSON

          public void toJSON(Path path)

      Specified by:
        `toJSON` in interface `JSONWritable`

${current.year} Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023