ML.REGRESSION.RIDGE¶
Creates a Ridge Regression object.
Syntax¶
Arguments¶
| Name | Type | Default | Description |
|---|---|---|---|
| alpha | float | 1.0 | Regularization strength; must be a positive float. Larger values specify stronger regularization. |
| fit_intercept | Any | TRUE | Whether to calculate the intercept for this model. If set to False, no intercept will be used in calculations (i.e., data is expected to be centered). |
Returns¶
A Ridge Regression model handle, ready to pass into ML.FIT.
When to use¶
Reach for ridge regression when ordinary linear regression overfits — usually because two or more of your features are highly correlated, or because you have only slightly more rows than columns. Ridge shrinks all coefficients toward zero with an L2 penalty, producing a more stable fit without zeroing any feature out.
Compared to the alternatives in this namespace:
- Use
ML.REGRESSION.LINEARwhen there is no multicollinearity and you want the unregularized fit. - Use ridge when features are correlated and you want all of them in the model, just dampened.
- Use
ML.REGRESSION.LASSOwhen you instead want only the most useful features to survive (others get coefficient 0). - Use
ML.REGRESSION.ELASTIC_NETwhen you want a blend of the two.
Examples¶
Fit a ridge model with the default alpha=1.0 on features in A2:E100
and the target in F2:F100:
Increase alpha to apply stronger shrinkage when you suspect heavy overfitting:
Set alpha=0 to recover ordinary least squares (equivalent to
ML.REGRESSION.LINEAR):
Remarks¶
alphais the regularization strength. Largeralpha= more shrinkage. Defaults to1.0. Try a small grid like0.01, 0.1, 1, 10, 100and pick the value that minimizes test error.- Scale your features first (e.g. with
ML.PREPROCESSING.STANDARD_SCALER) — Ridge applies the same penalty to every coefficient, so unequal feature scales bias the result. - Ridge keeps all features in the model with non-zero coefficients. If you
want automatic feature selection, use
ML.REGRESSION.LASSO.