Linear regression objective
objective_linear.RdBuilds a squared-error regression objective with optional elastic net penalization.
Usage
objective_linear(
x,
y,
weights = NULL,
lambda = 0,
alpha = 0,
lambda_l1 = NULL,
lambda_l2 = NULL,
include_intercept = TRUE,
penalize_intercept = FALSE,
loss_scale = NULL,
id = NULL,
label = NULL,
transform = objective_transform_identity()
)Arguments
- x
(
matrix()) Design matrix without an intercept column. Rows correspond to observations.- y
(
numeric()) Numeric responses for the regression task.- weights
(
numeric()) Optional non-negative weights with lengthnrow(x).- lambda
(
numeric(1)) Overall penalty strength used together withalphafor elastic net penalties.- alpha
(
numeric(1)) Elastic net mixing parameter in[0, 1].0corresponds to ridge,1to lasso.- lambda_l1
(
numeric(1)) Optional direct specification of the L1 penalty weight. Overrideslambda * alphawhen provided.- lambda_l2
(
numeric(1)) Optional direct specification of the L2 penalty weight. Overrideslambda * (1 - alpha)when provided.- include_intercept
(
logical(1)) IfTRUE, an intercept column is prepended toxbefore constructing the objective.- penalize_intercept
(
logical(1)) IfFALSEandinclude_intercept = TRUE, the intercept term is excluded from the penalties.- loss_scale
(
numeric(1)) Scaling factor applied to the summed squared errors. Defaults to1 / (2 * sum(weights)).- id
(
character(1)) Identifier forwarded to Objective. Defaults to"logreg".- label
(
character(1)) Label used for the resulting objective. Defaults to"logistic risk".- transform
(
objective_transform()) Optional scalar transformation applied to the empirical risk before it is returned. Defaults toobjective_transform_identity().
Value
An Objective instance capturing the squared-error regression risk.