hypertools.tools.procrustes

hypertools.tools.procrustes(source, target, scaling=True, reflection=True, reduction=False, oblique=False, oblique_rcond=-1, normalize=False, ndims=None)[source]

Function to project from one space to another using Procrustean transformation (shift + scaling + rotation + reflection).

The implementation of this function was based on the ProcrusteanMapper in pyMVPA: https://github.com/PyMVPA/PyMVPA

See also: http://en.wikipedia.org/wiki/Procrustes_transformation

Parameters:

source : Numpy array

Array to be aligned to target’s coordinate system.

target: Numpy array

Source is aligned to this target space

scaling : bool

Estimate a global scaling factor for the transformation (no longer rigid body)

reflection : bool

Allow for the data to be reflected (so it might not be a rotation. Effective only for non-oblique transformations.

reduction : bool

If true, it is allowed to map into lower-dimensional space. Forward transformation might be suboptimal then and reverse transformation might not recover all original variance.

oblique : bool

Either to allow non-orthogonal transformation – might heavily overfit the data if there is less samples than dimensions. Use oblique_rcond.

oblique_rcond : float

Cutoff for ‘small’ singular values to regularize the inverse. See lstsq for more information.

normalize : str or False

If set to ‘across’, the columns of the input data will be z-scored across lists (default). If set to ‘within’, the columns will be z-scored within each list that is passed. If set to ‘row’, each row of the input data will be z-scored. If set to False, the input data will be returned (default is False).

ndims : int

Number of dimensions to reduce the dataset to prior to alignment

Returns:

aligned_source : Numpy array

The array source is aligned to target and returned