Skip to content

Commit e6a6834

Browse files
author
ercbk
committed
added ncv image
1 parent e9166c6 commit e6a6834

File tree

4 files changed

+8
-35
lines changed

4 files changed

+8
-35
lines changed

README.Rmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ output: github_document
55
# Nested Cross-Validation: Comparing Methods and Implementations
66
### (In-progress)
77

8+
![](images/ncv.png)
9+
810
Nested cross-validation has become a recommended technique for situations in which the size of our dataset is insufficient to simultaneously handle hyperparameter tuning and algorithm comparison. Examples of such situations include: proof of concept, start-ups, medical studies, time series, etc. Using standard methods such as k-fold cross-validation in these cases may result in significant increases in optimization bias. Nested cross-validation has been shown to produce low bias, out-of-sample error estimates even using datasets with only hundreds of rows and therefore gives a better judgement of generalization performance.
911

1012
The primary issue with this technique is that it is computationally very expensive with potentially tens of 1000s of models being trained during the process. While researching this technique, I found two slightly different methods of performing nested cross-validation — one authored by [Sabastian Raschka](https://github.com/rasbt/stat479-machine-learning-fs19/blob/master/11_eval4-algo/code/11-eval4-algo__nested-cv_verbose1.ipynb) and the other by [Max Kuhn and Kjell Johnson](https://tidymodels.github.io/rsample/articles/Applications/Nested_Resampling.html).
@@ -109,7 +111,7 @@ durations
109111
Experiment details:
110112

111113
* The fastest implementation of each method will be used in running a nested cross-validation with different sizes of data ranging from 100 to 5000 observations and different numbers of repeats of the outer-loop cv strategy.
112-
* The {mlr3} implementation was the fastest for Raschka's method, but the Ranger-Kuhn-Johnson implementation was close. To simplify, I'll be using Ranger-Kuhn-Johnson for both methods.
114+
* The {mlr3} implementation was the fastest for Raschka's method, but the Ranger-Kuhn-Johnson implementation was close. To simplify, I'll be using [Ranger-Kuhn-Johnson](https://github.com/ercbk/nested-cross-validation-comparison/blob/master/duration-experiment/kuhn-johnson/nested-cv-ranger-kj.R) for both methods.
113115
* The chosen algorithm and hyperparameters will be used to predict on a 100K row simulated dataset.
114116
* The percent error between the the average mean absolute error (MAE) across the outer-loop folds and the MAE of the predictions on this 100K dataset will be calculated for each combination of repeat, data size, and method.
115117
* To make this experiment manageable in terms of runtimes, I'm using AWS instances: a r5.2xlarge for the Elastic Net and a r5.24xlarge for Random Forest.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
### (In-progress)
55

6+
![](images/ncv.png)
7+
68
Nested cross-validation has become a recommended technique for
79
situations in which the size of our dataset is insufficient to
810
simultaneously handle hyperparameter tuning and algorithm comparison.
@@ -88,7 +90,9 @@ Experiment details:
8890
outer-loop cv strategy.
8991
- The {mlr3} implementation was the fastest for Raschka’s method,
9092
but the Ranger-Kuhn-Johnson implementation was close. To
91-
simplify, I’ll be using Ranger-Kuhn-Johnson for both methods.
93+
simplify, I’ll be using
94+
[Ranger-Kuhn-Johnson](https://github.com/ercbk/nested-cross-validation-comparison/blob/master/duration-experiment/kuhn-johnson/nested-cv-ranger-kj.R)
95+
for both methods.
9296
- The chosen algorithm and hyperparameters will be used to predict on
9397
a 100K row simulated dataset.
9498
- The percent error between the the average mean absolute error (MAE)

images/ncv.png

23.4 KB
Loading

performance-experiment/plot-perf-results.R

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)