gemseo.mlearning.linear_model_fitting.ridge_cv_settings module#

Settings for the scikit-learn ridge algorithm with built-in cross-validation.

class GCVMode(*values)[source]#

Bases: StrEnum

Flag indicating the strategy for Leave-One-Out Cross-Validation.

AUTO = 'auto'#
EIGEN = 'eigen'#
SVD = 'svd'#
Settings RidgeCV_Settings(*, fit_intercept=True, alphas=(0.001, 0.01, 0.1, 1.0, 10.0), gcv_mode=GCVMode.AUTO, alpha_per_target=False, scoring=None, cv=None)[source]#

Bases: BaseLinearModelFitter_Settings

Settings for the scikit-learn ridge algorithm with build-in cross validation.

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.

  • alphas (tuple[Annotated[float, Ge(ge=0)], ...]) --

    By default it is set to (0.001, 0.01, 0.1, 1.0, 10.0).

  • gcv_mode (GCVMode) --

    By default it is set to "auto".

  • alpha_per_target (bool) --

    By default it is set to False.

  • scoring (str | Callable | None)

  • cv (int | None)

Return type:

None

alpha_per_target: bool = False#

The flag indicating whether to optimize the \(alpha\) value (picked from the alphas parameter list) for each target separately (for multi-output settings: multiple prediction targets).

alphas: tuple[NonNegativeFloat, ...] = (0.001, 0.01, 0.1, 1.0, 10.0)#

Values of \(\alpha\) to try. The constant \(\alpha\) multiplies the L2 term, controlling regularization strength.

cv: int | None = None#

The number of folds. If None, use the efficient Leave-One-Out cross-validation.

gcv_mode: GCVMode = GCVMode.AUTO#

The flag indicating which strategy to use when performing Leave-One-Out Cross-Validation.

scoring: str | Callable | None = None#

The scoring method to use for cross-validation. If None, use the mean squared error when cv is None and the coefficient of determination \(R^2\) otherwise