Package mvpa :: Package datasets :: Module metric
[hide private]
[frames] | no frames]

Module metric

source code

Classes and functions to provide sense of distances between sample points
Classes [hide private]
  Metric
Abstract class for any finder.
  DescreteMetric
Find neighboring points in descretized space
Functions [hide private]
 
cartesianDistance(a, b)
Return Cartesian distance between a and b
source code
 
absminDistance(a, b)
Returns dinstance max(|a-b|) XXX There must be better name!
source code
 
manhattenDistance(a, b)
Return Manhatten distance between a and b
source code
 
mahalanobisDistance(x, y=None, w=None)
Caclulcate Mahalanobis distance of the pairs of points.
source code

Imports: N


Function Details [hide private]

absminDistance(a, b)

source code 

Returns dinstance max(|a-b|) XXX There must be better name!

Useful to select a whole cube of a given "radius"

mahalanobisDistance(x, y=None, w=None)

source code 

Caclulcate Mahalanobis distance of the pairs of points.

Inverse covariance matrix can be calculated with the following

w = N.linalg.solve(N.cov(x.T),N.identity(x.shape[1]))

or

w = N.linalg.inv(N.cov(x.T))
Parameters:
  • x - first list of points. Rows are samples, columns are features.
  • y - second list of points (optional)
  • w (N.ndarray) - optional inverse covariance matrix between the points. It is computed if not given