Skip to contents

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.

Usage

morie_geron_ridge_cost(X, y, theta, alpha, intercept_index = 0)

Arguments

X, y, theta

Design, targets, coefficients.

alpha

Non-negative penalty.

intercept_index

0-based index left unpenalised, or NULL.

Value

List with cost, mse, penalty, gradient, alpha, estimate, n.

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"
#>