Skip to contents

J = MSE + (alpha/2) sum_{i>=1} theta_i^2 with the bias unpenalised; the gradient is returned alongside.

Usage

morie_geron_ridge_cost_grridg(X, y, theta, alpha, intercept = TRUE)

Arguments

X, y, theta

Design, targets and parameters.

alpha

Non-negative penalty.

intercept

Treat theta[1] as an unpenalised bias.

Value

List with cost, mse, penalty, gradient.

Examples

morie_geron_ridge_cost_grridg(X = 5L, y = 5L, theta = 0.5, alpha = 0.5)
#> $cost
#> [1] 6.25
#> 
#> $mse
#> [1] 6.25
#> 
#> $penalty
#> [1] 0
#> 
#> $gradient
#> [1] -25
#> 
#> $estimate
#> [1] 6.25
#> 
#> $n
#> [1] 1
#>