Solvers module
Regression solvers for TRF (temporal response function) fitting.
This module provides the building blocks used to fit linear regression models on (possibly segmented / multi-epoch) data:
svd_solverandSVDSolver: ridge / truncated-SVD regression via the SVD of the normal matrixXᵀX(or of the tall design matrixXwithuse_full_svd=True).LSTSQSolver: plain least-squares regression vianumpy.linalg.lstsqon the accumulated normal equations.conjugate_gradient,block_conjugate_gradientandConjugateGradientSolver: iterative solves of the (regularized) normal equations, optionally preconditioned.IRLSSolver: robust regression using Cauchy-loss iteratively reweighted least squares.ScipyRobustSolver: reference robust Cauchy-loss regression built onscipy.optimize.least_squares(unregularized, small dense problems; validates the IRLS path).Regularizers:
create_laplacian_matrixandcreate_quadratic_regularizerbuild quadratic (smoothness) penalty matrices;incomplete_cholesky_preconditioneranddiagonal_preconditionerbuild preconditioners for CG.The
Solverabstract base class andSolverResultdataclass define the common interface: every solver accepts(X, y, alpha, M)and returns aSolverResult.
Classes
|
Abstract base class for regression solvers. |
|
Result container for solver runs. |
|
Linear regression using the singular value decomposition (SVD). |
|
Linear regression using least squares ( |
|
Regression solver using Conjugate Gradient on normal equations. |
|
Fit a robust linear model using Cauchy-loss IRLS. |
|
Fit Cauchy-loss regression with SciPy's nonlinear least-squares solver. |
Functions
|
Create a Laplacian matrix for smoothness constraints in quadratic regularization. |
|
Factory function to create quadratic regularization matrices. |
|
Solve the linear system Ax = b using the SVD method. |
Compute the Incomplete Cholesky preconditioner for matrix A. |
|
Compute the Diagonal preconditioner for matrix A. |
|
|
Solve the linear system Ax = b using the Conjugate Gradient method. |
|
Block Conjugate Gradient: solve A X = B for multiple right-hand sides. |