pyeeg.solvers.IRLSSolver

class pyeeg.solvers.IRLSSolver(loss='cauchy', scale=None, max_iter=20, tol=1e-06, damping=1.0, inner_solver='svd', inner_tol=1e-08, inner_max_iter=None, n_jobs=1, verbose=False)

Fit a robust linear model using Cauchy-loss IRLS.

The Cauchy loss is log(1 + (residual / scale)**2). Each IRLS step solves a weighted least-squares problem with weights 1 / (1 + (residual / scale)**2). Array, list-of-arrays, and 3-D multi-segment targets are accepted.

Each channel is solved independently with its own convergence criterion (some channels may converge faster than others). When n_jobs > 1, channels are processed in parallel using joblib.

Parameters:
  • n_jobs (int, optional) – Number of parallel jobs for per-channel IRLS. Default 1 (sequential). Use -1 for all available cores. When parallel, each worker uses a single BLAS thread to avoid oversubscription.

  • loss (str) – Only ‘cauchy’ is supported.

  • scale (float or None) – Fixed scale for the Cauchy loss. If None, estimated from residuals.

  • max_iter (int) – Maximum IRLS iterations per channel.

  • tol (float) – Convergence tolerance (per-channel).

  • damping (float) – Damping factor for the IRLS step (0, 1].

  • inner_solver (str) – Inner solver for weighted normal equations: ‘svd’ or ‘cg’.

  • inner_tol (float) – Tolerance for the inner CG solver.

  • inner_max_iter (int or None) – Max iterations for the inner CG solver.

  • verbose (bool) – Print per-iteration progress.

Returns:

result – betas : ndarray (n_features, n_channels) info : dict with n_iter, converged, scale, objective

Return type:

SolverResult

Methods

IRLSSolver.solve(X, y[, alpha, M])

Fit the robust Cauchy-loss IRLS model and return coefficients.