pyeeg.solvers.ConjugateGradientSolver.solve

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

Solve the regression problem with block conjugate gradient.

Accumulates the normal equations XᵀX and Xᵀy across segments / epochs when needed, optionally adds the quadratic regularizer M, and solves for all output channels simultaneously with block_conjugate_gradient().

Parameters:
  • X (ndarray or list of ndarray) – Design matrix (n_samples, n_features) or list of segments (with possibly different n_samples).

  • y (ndarray or list of ndarray) – Target (n_samples, n_channels), 3-D array (n_epochs, n_samples, n_channels), or list of arrays (one per segment).

  • alpha (float, optional) – Tikhonov/L2 regularization strength. When M is provided, alpha is ignored in the solve. Default is 0.0.

  • M (ndarray or None, optional) – Quadratic regularization matrix added to XᵀX. If provided, it replaces the L2 (alpha) regularization. Default is None.

Returns:

resultbetas has shape (n_features, n_channels); info is None.

Return type:

SolverResult