gemseo.mlearning.linear_model_fitting.ridge_settings module#
Settings for the scikit-learn ridge algorithm.
- Settings Ridge_Settings(*, fit_intercept=True, alpha=1.0, copy_X=True, max_iter=None, positive=False, random_state=None, solver=Solver.AUTO, tol=0.0001)[source]#
Bases:
BaseLinearModelFitter_SettingsSettings for the scikit-learn ridge algorithm.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
fit_intercept (bool) --
By default it is set to True.
alpha (Annotated[float, Ge(ge=0)] | ndarray) --
By default it is set to 1.0.
copy_X (bool) --
By default it is set to True.
positive (bool) --
By default it is set to False.
random_state (int | RandomState | None)
solver (Solver) --
By default it is set to "auto".
tol (Annotated[float, Ge(ge=0)]) --
By default it is set to 0.0001.
- Return type:
None
- alpha: NonNegativeFloat | ndarray = 1.0#
The constant \(\alpha\) that multiplies the L2 term, controlling regularization strength. If an array is passed, penalties are assumed to be specific to the targets.
- max_iter: PositiveInt | None = None#
The maximum number of iterations for conjugate gradient solver. For "sparse_cg" and "lsqr" solvers, the default value is determined by
scipy.sparse.linalg. For "sag" solver, the default value is 1000. For "lbfgs" solver, the default value is 15000.
- positive: bool = False#
When set to
True, forces the coefficients to be positive. Only "lbfgs" solver is supported in this case.
- random_state: int | RandomState | None = None#
Used when
solver == 'sag'or'saga'to shuffle the data.
- solver: Solver = Solver.AUTO#
The solver to use in the computational routines. If
"auto", the solver is automatically chosen based on the type of data.
- tol: NonNegativeFloat = 0.0001#
The precision of the solution is determined by
tolwhich specifies a different convergence criterion for each solver:"svd":
tolhas no impact."cholesky":
tolhas no impact."sparse_cg": norm of residuals smaller than
tol."lsqr":
tolis set asatolandbtolof scipy.sparse.linalg.lsqr``, which control the norm of the residual vector in terms of the norms of matrix and coefficients."sag" and "saga": relative change of coef smaller than
tol."lbfgs": maximum of the absolute (projected)
gradient=max|residuals|smaller than tol.
- Constraints:
ge = 0