pub fn ridge_regression(
x: &Array2<Float>,
y: &Array1<Float>,
alpha: Float,
fit_intercept: bool,
solver: &str,
) -> Result<(Array1<Float>, Float)>Expand description
Ridge regression solver
Solves the ridge regression problem: argmin ||y - X @ coef||^2 + alpha * ||coef||^2
§Arguments
x- Design matrix of shape (n_samples, n_features)y- Target values of shape (n_samples,) or (n_samples, n_targets)alpha- Regularization strength (must be positive)fit_intercept- Whether to fit an interceptsolver- Solver to use (“auto”, “svd”, “cholesky”, “lsqr”, “sparse_cg”, “sag”, “saga”)
§Returns
- Coefficients of shape (n_features,) or (n_features, n_targets)
- Intercept (scalar or array)