Documentation of 'Catalano.MachineLearning.Regression.KNearestNeighbors' Java class
KNearestNeighbors
Catalano.MachineLearning.Regression

Class KNearestNeighbors

  • All Implemented Interfaces:
    IRegression, java.io.Serializable, java.lang.Cloneable


    public class KNearestNeighbors
    extends java.lang.Object
    implements IRegression, java.io.Serializable
    K Nearest Neighbors for regression.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      IRegression clone()
      Clone of the object.
      int getK()
      Get number of neighbors.
      void Learn(DatasetRegression dataset)
      Learn.
      void Learn(double[][] input, double[] output)
      Learn.
      double Predict(double[] feature)
      Predict.
      void setK(int k)
      Set number of neighbors.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • KNearestNeighbors

        public KNearestNeighbors()
        Initializes a new instance of the KNearestNeighbors class.
      • KNearestNeighbors

        public KNearestNeighbors(int k)
        Initializes a new instance of the KNearestNeighbors class.
        Parameters:
        k - Number of neighbors.
      • KNearestNeighbors

        public KNearestNeighbors(int k,
                                 IDivergence divergence)
        Initializes a new instance of the KNearestNeighbors class.
        Parameters:
        k - Number of neighbors.
        divergence - Divergence.
      • KNearestNeighbors

        public KNearestNeighbors(int k,
                                 IMercerKernel kernel)
        Initializes a new instance of the KNearestNeighbors class.
        Parameters:
        k - Number of neighbors.
        kernel - Kernel.
    • Method Detail

      • getK

        public int getK()
        Get number of neighbors.
        Returns:
        Number of neighbors.
      • setK

        public void setK(int k)
        Set number of neighbors.
        Parameters:
        k - Number of neighbors.
      • Learn

        public void Learn(double[][] input,
                          double[] output)
        Description copied from interface: IRegression
        Learn.
        Specified by:
        Learn in interface IRegression
        Parameters:
        input - Input.
        output - Output.
      • Predict

        public double Predict(double[] feature)
        Description copied from interface: IRegression
        Predict.
        Specified by:
        Predict in interface IRegression
        Parameters:
        feature - Feature.
        Returns:
        Value.
      • clone

        public IRegression clone()
        Description copied from interface: IRegression
        Clone of the object.
        Specified by:
        clone in interface IRegression
        Overrides:
        clone in class java.lang.Object
        Returns:
        A new copy of the object.

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.