pyeeg.solvers.SVDSolver.solve

SVDSolver.solve(X, y, alpha=0.0, M=None)

Solve the SVD regression and return the coefficients.

X may be a 2-D array or a list of 2-D arrays (segments / trials). When a list is given (with possibly different n_samples), the covariance matrices are accumulated across trials; the number of samples must then be the same in X and y per trial. If y is a 3-D array (n_epochs, n_samples, n_chans), the normal equations are accumulated across epochs.

Parameters:
  • X (ndarray (n_samples, n_features) or list of such) – Design matrix, or list of segments to accumulate.

  • y (ndarray (n_samples, n_channels) or list of such) – Target. If y is a list of arrays, each element is treated as an individual subject / segment and the betas coefficients are computed on the accumulated covariance matrices.

  • alpha (float or array-like, optional) – Regularization parameter (Tikhonov/L2). If array-like, betas are computed for every regularization value at once. When M is provided, alpha no longer enters the solve (it only controls the size of the last output axis for API compatibility). Default is 0.0.

  • M (ndarray, optional) – Quadratic regularization matrix (e.g. smoothness / Laplacian). If provided, it REPLACES the L2 (alpha) regularization: the solution becomes betas = (XᵀX + M)⁻¹ Xᵀy. Default is None.

Returns:

resultbetas has shape (n_features, n_channels) or (n_features, n_channels, len(alpha)) when alpha is array-like; info is None.

Return type:

SolverResult