evomap.transform#
Module for transforming lower-dimensional maps post-creation, including alignment and rotation.
Module Contents#
Functions#
|
Align a sequence of maps to a reference map using Orthogonal Procrustes Analysis. |
|
Align a single map to a reference map using Orthogonal Procrustes Analysis. |
|
Perform Principal Component Analysis (PCA). |
|
Rotate a 2D map to align along the direction of maximum variance using PCA. |
|
Rotate multiple maps such that the x-axis corresponds to the direction of maximum variance, |
- evomap.transform.align_maps(Xs, X_ref)[source]#
Align a sequence of maps to a reference map using Orthogonal Procrustes Analysis.
- Parameters:
Xs (list of ndarray) – List of map coordinates, each of shape (n_samples, n_dims)
X_ref (ndarray) – Reference map, shape (n_samples, n_dims)
- Returns:
List of aligned map coordinates, each of shape (n_samples, n_dims)
- Return type:
list of ndarray
- evomap.transform.align_map(X, X_ref)[source]#
Align a single map to a reference map using Orthogonal Procrustes Analysis.
- Parameters:
X (ndarray) – Map coordinates, shape (n_samples, n_dims)
X_ref (ndarray) – Reference map, shape (n_samples, n_dims)
- Returns:
Aligned map, shape (n_samples, n_dims)
- Return type:
ndarray
- evomap.transform.PCA(X, num_components)[source]#
Perform Principal Component Analysis (PCA).
- Parameters:
X (ndarray) – Data matrix, shape (n_samples, n_features)
num_components (int) – Number of principal components to retain
- Returns:
Reduced dimensionality data, shape (n_samples, num_components)
- Return type:
ndarray
- evomap.transform.rotate_map(Y_2D)[source]#
Rotate a 2D map to align along the direction of maximum variance using PCA.
- Parameters:
Y_2D (ndarray) – 2D map, shape (n_samples, 2)
- Returns:
Rotated map, shape (n_samples, 2)
- Return type:
ndarray
- evomap.transform.rotate_maps(Y, inclusions)[source]#
Rotate multiple maps such that the x-axis corresponds to the direction of maximum variance, controlled by an inclusion parameter which determines which elements within each map are subject to rotation.
- Parameters:
Y (list of ndarray) – List of maps, each map shape (n_samples, n_dims)
inclusions (list of ndarray) – List of 0/1 vectors, each vector of length n_samples indicating whether the corresponding element in a map should be included in rotation.
- Returns:
List of rotated maps, each map shape (n_samples, n_dims)
- Return type:
list of ndarray
- Raises:
ValueError – If the length of any inclusion vector does not match the number of samples in its corresponding map.