Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

3.3.4. fmralign.alignment_methods.RidgeAlignment

class fmralign.alignment_methods.RidgeAlignment(alphas=[0.1, 1.0, 10.0, 100, 1000], cv=4)[source]

Compute a scikit-estimator R using a mixing matrix M s.t Frobenius norm || XM - Y ||^2 + alpha * ||M||^2 is minimized with cross-validation

Parameters

R : scikit-estimator from sklearn.linear_model.RidgeCV

with methods fit, predict

alpha : numpy array of shape [n_alphas]

Array of alpha values to try. Regularization strength; must be a positive float. Regularization improves the conditioning of the problem and reduces the variance of the estimates. Larger values specify stronger regularization. Alpha corresponds to C^-1 in other models such as LogisticRegression or LinearSVC.

cv : int, cross-validation generator or an iterable, optional

Determines the cross-validation splitting strategy. Possible inputs for cv are: -None, to use the efficient Leave-One-Out cross-validation - integer, to specify the number of folds. - An object to be used as a cross-validation generator. - An iterable yielding train/test splits.

__init__(alphas=[0.1, 1.0, 10.0, 100, 1000], cv=4)[source]

Initialize self. See help(type(self)) for accurate signature.

fit(X, Y)[source]

Fit R s.t. || XR - Y ||^2 + alpha ||R||^2 is minimized with cv

Parameters

X: (n_samples, n_features) nd array

source data

Y: (n_samples, n_features) nd array

target data

fit_transform(X, y=None, **fit_params)

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.

Parameters

X : numpy array of shape [n_samples, n_features]

Training set.

y : numpy array of shape [n_samples]

Target values.

Returns

X_new : numpy array of shape [n_samples, n_features_new]

Transformed array.

get_params(deep=True)

Get parameters for this estimator.

Parameters

deep : boolean, optional

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns

params : mapping of string to any

Parameter names mapped to their values.

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns

self

transform(X)[source]

Transform X using optimal transform computed during fit.