
Lasso cost = MSE + alpha * L1 penalty (Geron Ch 4, morie.fn hmlaso)
Source:R/geron_w4b_native.R
morie_geron_lasso_cost_hmlaso.RdLasso cost = MSE + alpha * L1 penalty (Geron Ch 4, morie.fn hmlaso)
Examples
morie_geron_lasso_cost_hmlaso(X = c(1, 2, 3, 4, 5, 6, 7, 8), y = c(1, 2, 3, 4, 5, 6, 7, 8),
theta = 0.5, alpha = 0.5)
#> $cost
#> [1] 6.625
#>
#> $mse
#> [1] 6.375
#>
#> $penalty
#> [1] 0.25
#>
#> $gradient
#> [1] -25
#>
#> $residuals
#> [1] -0.5 -1.0 -1.5 -2.0 -2.5 -3.0 -3.5 -4.0
#>
#> $n_zero
#> [1] 0
#>
#> $alpha
#> [1] 0.5
#>
#> $estimate
#> [1] 6.625
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Lasso cost = MSE + alpha * L1 penalty"
#>