mvpa2.clfs.distance.pnorm_w_python¶
-
mvpa2.clfs.distance.
pnorm_w_python
(data1, data2=None, weight=None, p=2, heuristic='auto', use_sq_euclidean=True)¶ 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: data1 : np.ndarray
First dataset
data2 : np.ndarray or None
Optional second dataset
weight : np.ndarray or None
Optional weights per 2nd dimension (features)
p
Power
heuristic : str
- Which heuristic to use:
- ‘samples’ – python sweep over 0th dim
- ‘features’ – python sweep over 1st dim
- ‘auto’ decides automatically. If # of features (shape[1]) is much larger than # of samples (shape[0]) – use ‘samples’, and use ‘features’ otherwise
use_sq_euclidean : bool
Either to use squared_euclidean_distance_matrix for computation if p==2