pyeeg.solvers.SVDSolver
- class pyeeg.solvers.SVDSolver(verbose=False, truncated=False, use_full_svd=False)
Linear regression using the singular value decomposition (SVD).
Solves the regularized normal equations
(XᵀX + lambda I + M) beta = Xᵀyvia SVD. By default the SVD is computed on the small normal matrixXᵀX(n_features, n_features), which is much faster for tall matrices (n_samples >> n_features) and gives identical results to factorizing the tall design matrixXdirectly.- Parameters:
verbose (bool, optional) – Whether to print progress information. Default is False.
truncated (bool, optional) – If True,
alphais reinterpreted as the fraction of total variance to keep (between 0 and 1). Instead of Tikhonov regularization (which shrinks all components), truncated SVD keeps the top-k components explainingalphaof the variance and discards the rest entirely. Incompatible withM(quadratic regularizer). Default is False.use_full_svd (bool, optional) – If True, SVD the tall design matrix
X(n_samples, n_features) for higher numerical precision. If False (default), SVD the small normal matrixXᵀX(n_features, n_features) which is much faster for tall matrices (n_samples >> n_features) and gives identical results. Default is False.
Notes
A warning is shown in the case where n_features > n_samples; if so the user should rather use partial regression.
Methods
SVDSolver.solve(X, y[, alpha, M])Solve the SVD regression and return the coefficients.