Class CorrelationDistance

java.lang.Object
smile.math.distance.CorrelationDistance
All Implemented Interfaces:
Serializable, ToDoubleBiFunction<double[],double[]>, Distance<double[]>

public class CorrelationDistance extends Object implements Distance<double[]>
Correlation distance is defined as 1 - correlation coefficient.
See Also:
  • Constructor Details

    • CorrelationDistance

      public CorrelationDistance()
      Constructor of Pearson correlation distance.
    • CorrelationDistance

      public CorrelationDistance(String method)
      Constructor.
      Parameters:
      method - the type of correlation.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • d

      public double d(double[] x, double[] y)
      Pearson correlation distance between the two arrays of type double.
      Specified by:
      d in interface Distance<double[]>
      Parameters:
      x - an object.
      y - an object.
      Returns:
      the distance.