![]() |
Multivariate Pattern Analysis in Python |
Distance functions to be used in kernels and elsewhere
Returns dinstance max(|a-b|) XXX There must be better name! XXX Actually, why is it absmin not absmax?
Useful to select a whole cube of a given “radius”
Calculate Mahalanobis distance of the pairs of points.
Parameters: |
|
---|
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))
Return one minus the correlation matrix between the rows of two matrices.
This functions computes a matrix of correlations between all pairs of rows of two matrices. Unlike NumPy’s corrcoef() this function will only considers pairs across matrices and not within, e.g. both elements of a pair never have the same source matrix as origin.
Both arrays need to have the same number of columns.
Parameters: |
|
---|
Example:
>>> X = N.random.rand(20,80)
>>> Y = N.random.rand(5,80)
>>> C = oneMinusCorrelation(X, Y)
>>> print C.shape
(20, 5)
Weighted p-norm between two datasets (pure Python implementation)
||x - x’||_w = (sum_{i=1...N} (w_i*|x_i - x’_i|)**p)**(1/p)
Parameters: |
|
---|
Compute weighted euclidean distance matrix between two datasets.
Parameters: |
|
---|