Skip to contents

OLS refit (normal equation) on growing prefixes of the training half; the split is the FIRST m - n_val rows, no shuffling.

Usage

morie_geron_learning_curves(X, y, n_splits = 10, val_fraction = 0.2)

Arguments

X, y

Data.

n_splits

Number of training sizes (unique after rounding).

val_fraction

Validation share in (0, 1).

Value

List with train_sizes, train_rmse, val_rmse, final_gap, val_size.

Examples

X <- matrix(c(1, 2, 1, 3, 1, 5, 1, 7), 4, byrow = TRUE)
y <- c(2, 3, 6, 9)
th <- c(0.5, 1.1)
morie_geron_elastic_net_cost(X, y, th, 0.4, 0.6)
#> $cost
#> [1] 0.8033
#> 
#> $mse
#> [1] 0.4425
#> 
#> $l1_penalty
#> [1] 0.264
#> 
#> $l2_penalty
#> [1] 0.0968
#> 
#> $l1_norm
#> [1] 1.1
#> 
#> $l2_norm_sq
#> [1] 1.21
#> 
#> $alpha
#> [1] 0.4
#> 
#> $r
#> [1] 0.6
#> 
#> $estimate
#> [1] 0.8033
#> 
#> $n
#> [1] 4
#> 
morie_geron_learning_curves(X = X, y = y)
#> $train_sizes
#> [1] 2 3
#> 
#> $train_rmse
#> [1] 1.570092e-16 1.543033e-01
#> 
#> $val_rmse
#> [1] 2.0000000 0.3571429
#> 
#> $final_gap
#> [1] 0.2028395
#> 
#> $val_size
#> [1] 1
#> 
#> $estimate
#> [1] 2.0000000 0.3571429
#> 
#> $n
#> [1] 4
#>