Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## baseCode.math
Class Distance

    java.lang.Object
      baseCode.math.Distance

public class Distance
extends java.lang.Object

Alternative distance and similarity metrics for vectors.

Copyright (c) 2004

Institution:: Columbia University

Version:
  $Id: Distance.java,v 1.7 2004/08/14 20:38:35 pavlidis Exp $
Author:
  Paul Pavlidis

Constructor Summary
`Distance()`

Method Summary
`static double` | `correlationOfStandardized(double[] xe, double[] ye)` Highly optimized implementation of the Pearson correlation.
`static double` | `correlationOfStandardized(cern.colt.list.DoubleArrayList x, cern.colt.list.DoubleArrayList y)` Like correlationofNormedFast, but takes DoubleArrayLists as inputs, handles missing values correctly, and does more error checking.
`double` | `euclDistance(cern.colt.list.DoubleArrayList x, cern.colt.list.DoubleArrayList y)` Calculate the Euclidean distance between two vectors.
`double` | `manhattanDistance(cern.colt.list.DoubleArrayList x, cern.colt.list.DoubleArrayList y)` Calculate the Manhattan distance between two vectors.
`static double` | `spearmanRankCorrelation(cern.colt.list.DoubleArrayList x, cern.colt.list.DoubleArrayList y)` Spearman Rank Correlation.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Distance

    public Distance()

Method Detail

### manhattanDistance

    public double manhattanDistance(cern.colt.list.DoubleArrayList x,
                                    cern.colt.list.DoubleArrayList y)

  Calculate the Manhattan distance between two vectors.

  Parameters:
    `x` - DoubleArrayList
    `y` - DoubleArrayList
  Returns:
    Manhattan distance between x and y

### euclDistance

    public double euclDistance(cern.colt.list.DoubleArrayList x,
                               cern.colt.list.DoubleArrayList y)

  Calculate the Euclidean distance between two vectors.

  Parameters:
    `x` - DoubleArrayList
    `y` - DoubleArrayList
  Returns:
    Euclidean distance between x and y

### spearmanRankCorrelation

    public static double spearmanRankCorrelation(cern.colt.list.DoubleArrayList x,
                                                 cern.colt.list.DoubleArrayList y)

  Spearman Rank Correlation. This does the rank transformation of the data.

  Parameters:
    `x` - DoubleArrayList
    `y` - DoubleArrayList
  Returns:
    Spearman's rank correlation between x and y.

### correlationOfStandardized

    public static double correlationOfStandardized(double[] xe,
                                                   double[] ye)

  Highly optimized implementation of the Pearson correlation. The inputs must be standardized - mean zero, variance one, without any missing values.

  Parameters:
    `xe` - A standardized vector
    `ye` - A standardized vector
  Returns:
    Pearson correlation coefficient.

### correlationOfStandardized

    public static double correlationOfStandardized(cern.colt.list.DoubleArrayList x,
                                                   cern.colt.list.DoubleArrayList y)

  Like correlationofNormedFast, but takes DoubleArrayLists as inputs, handles missing values correctly, and does more error checking. Assumes the data has been converted to z scores already.

  Parameters:
    `x` - A standardized vector
    `y` - A standardized vector
  Returns:
    The Pearson correlation between x and y.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2005 Columbia University. All Rights Reserved.