MSE + (alpha/2) ||theta||^2 with the intercept coefficient left
unpenalised. intercept_index is 0-based, as in Python; pass NULL
to penalise every coefficient.
Examples
morie_geron_ridge_cost(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.375
#>
#> $mse
#> [1] 6.375
#>
#> $penalty
#> [1] 0
#>
#> $gradient
#> [1] -25.5
#>
#> $alpha
#> [1] 0.5
#>
#> $estimate
#> [1] 6.375
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Ridge cost MSE + (alpha/2)||theta||^2 with an unpenalised bias"
#>
