
Lasso cost, 2*alpha convention (Geron Eq 4-11, morie.fn grn011)
Source:R/geron_train_native.R
morie_geron_ch4_lasso_regression_cost_function.RdLasso cost, 2*alpha convention (Geron Eq 4-11, morie.fn grn011)
Usage
morie_geron_ch4_lasso_regression_cost_function(
X,
y,
theta,
alpha,
penalize_intercept = FALSE
)Examples
morie_geron_ch4_lasso_regression_cost_function(X = c(1, 2, 3, 4, 5, 6, 7, 8), y = 5L,
theta = c(1, 2, 3, 4, 5, 6, 7, 8), alpha = 0.5)
#> $cost
#> [1] 39636
#>
#> $mse
#> [1] 39601
#>
#> $l1_penalty
#> [1] 35
#>
#> $l1_norm
#> [1] 35
#>
#> $alpha
#> [1] 0.5
#>
#> $effective_alpha
#> [1] 1
#>
#> $estimate
#> [1] 39636
#>
#> $n
#> [1] 1
#>