Skip to contents

Early stopping: batch GD keeping the best validation snapshot (hmearl)

Usage

morie_geron_early_stopping_alt(
  X_train,
  y_train,
  X_val,
  y_val,
  n_iter = 100,
  eta = 0.01,
  patience = NULL,
  fit_intercept = TRUE
)

Arguments

X_train, y_train, X_val, y_val

Data.

n_iter, eta, fit_intercept

Training config.

patience

Optional online stopping patience.

Value

List with theta, best_iter, best_val_rmse, stopped_iter, is_u_shaped.

Examples

morie_geron_early_stopping_alt(X_train = c(1, 2, 3, 4, 5, 6, 7, 8),
  y_train = c(1, 2, 3, 4, 5, 6, 7, 8), X_val = c(1, 2, 3, 4, 5, 6, 7, 8),
  y_val = c(1, 2, 3, 4, 5, 6, 7, 8))
#> $theta
#> [1] 0.1155652 0.9794452
#> 
#> $best_iter
#> [1] 100
#> 
#> $best_val_rmse
#> [1] 0.05244317
#> 
#> $stopped_iter
#> NULL
#> 
#> $val_rmse
#>   [1] 5.04975247 2.39452501 1.13703745 0.54321873 0.26623780 0.14308875
#>   [7] 0.09546202 0.08077427 0.07685863 0.07571778 0.07522610 0.07488298
#>  [13] 0.07457437 0.07427446 0.07397744 0.07368199 0.07338780 0.07309481
#>  [19] 0.07280298 0.07251233 0.07222284 0.07193450 0.07164731 0.07136127
#>  [25] 0.07107637 0.07079261 0.07050998 0.07022849 0.06994811 0.06966885
#>  [31] 0.06939071 0.06911368 0.06883776 0.06856293 0.06828921 0.06801657
#>  [37] 0.06774503 0.06747457 0.06720518 0.06693688 0.06666964 0.06640348
#>  [43] 0.06613837 0.06587432 0.06561133 0.06534939 0.06508849 0.06482864
#>  [49] 0.06456982 0.06431204 0.06405528 0.06379955 0.06354484 0.06329115
#>  [55] 0.06303847 0.06278680 0.06253613 0.06228647 0.06203780 0.06179012
#>  [61] 0.06154343 0.06129773 0.06105301 0.06080927 0.06056650 0.06032469
#>  [67] 0.06008386 0.05984398 0.05960507 0.05936710 0.05913009 0.05889402
#>  [73] 0.05865890 0.05842471 0.05819146 0.05795914 0.05772775 0.05749728
#>  [79] 0.05726773 0.05703910 0.05681138 0.05658457 0.05635866 0.05613366
#>  [85] 0.05590956 0.05568635 0.05546403 0.05524260 0.05502205 0.05480238
#>  [91] 0.05458359 0.05436568 0.05414863 0.05393245 0.05371713 0.05350268
#>  [97] 0.05328908 0.05307633 0.05286443 0.05265338 0.05244317
#> 
#> $train_rmse
#>   [1] 5.04975247 2.39452501 1.13703745 0.54321873 0.26623780 0.14308875
#>   [7] 0.09546202 0.08077427 0.07685863 0.07571778 0.07522610 0.07488298
#>  [13] 0.07457437 0.07427446 0.07397744 0.07368199 0.07338780 0.07309481
#>  [19] 0.07280298 0.07251233 0.07222284 0.07193450 0.07164731 0.07136127
#>  [25] 0.07107637 0.07079261 0.07050998 0.07022849 0.06994811 0.06966885
#>  [31] 0.06939071 0.06911368 0.06883776 0.06856293 0.06828921 0.06801657
#>  [37] 0.06774503 0.06747457 0.06720518 0.06693688 0.06666964 0.06640348
#>  [43] 0.06613837 0.06587432 0.06561133 0.06534939 0.06508849 0.06482864
#>  [49] 0.06456982 0.06431204 0.06405528 0.06379955 0.06354484 0.06329115
#>  [55] 0.06303847 0.06278680 0.06253613 0.06228647 0.06203780 0.06179012
#>  [61] 0.06154343 0.06129773 0.06105301 0.06080927 0.06056650 0.06032469
#>  [67] 0.06008386 0.05984398 0.05960507 0.05936710 0.05913009 0.05889402
#>  [73] 0.05865890 0.05842471 0.05819146 0.05795914 0.05772775 0.05749728
#>  [79] 0.05726773 0.05703910 0.05681138 0.05658457 0.05635866 0.05613366
#>  [85] 0.05590956 0.05568635 0.05546403 0.05524260 0.05502205 0.05480238
#>  [91] 0.05458359 0.05436568 0.05414863 0.05393245 0.05371713 0.05350268
#>  [97] 0.05328908 0.05307633 0.05286443 0.05265338 0.05244317
#> 
#> $final_theta
#> [1] 0.1155652 0.9794452
#> 
#> $final_val_rmse
#> [1] 0.05244317
#> 
#> $is_u_shaped
#> [1] FALSE
#> 
#> $patience
#> NULL
#> 
#> $eta
#> [1] 0.01
#> 
#> $estimate
#> [1] 0.05244317
#> 
#> $n
#> [1] 8
#> 
#> $method
#> [1] "batch gradient descent with best-snapshot early stopping"
#>