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ᵀXandXᵀyacross segments / epochs when needed, optionally adds the quadratic regularizerM, and solves for all output channels simultaneously withblock_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
Mis provided,alphais 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:
result –
betashas shape (n_features, n_channels);infois None.- Return type: