Skip to contents

Manual implementation of the sklearn morie_learning_curve flow: shuffle, split into k folds, for each train-fraction fit on a prefix of the training fold and score on the held-out fold.

Usage

morie_learning_curve(x, y, sizes = NULL, cv = 5L, seed = 0L)

Arguments

x

Numeric matrix predictors.

y

Numeric response.

sizes

Training-set fractions (default seq(0.1, 1.0, length=5)).

cv

Number of CV folds.

seed

RNG seed for shuffling.

Value

Named list: estimate (final val MSE), train_sizes, train_scores, val_scores, n, method.

Examples

morie_learning_curve(x = rnorm(50), y = rnorm(50))
#> $estimate
#> [1] 1.049099
#> 
#> $train_sizes
#> [1]  4 13 22 31 40
#> 
#> $train_scores
#> [1] 0.1994974 0.7689296 0.9813182 1.1314751 0.9778524
#> 
#> $val_scores
#> [1] 1.880810 1.063200 1.041564 1.051803 1.049099
#> 
#> $n
#> [1] 50
#> 
#> $method
#> [1] "Learning curve (cv MSE)"
#>