Skip to content

Use fold i's SL fit for fold i validation predictions in cv_sl (#437) - #438

Open
corneliushennch wants to merge 1 commit into
tlverse:masterfrom
corneliushennch:fix-cv-sl-fold-index
Open

corneliushennch wants to merge 1 commit into
tlverse:masterfrom
corneliushennch:fix-cv-sl-fold-index

Conversation

@corneliushennch

Copy link
Copy Markdown

As @ctesta01 already pointed out in #437, I also came across this potential bug in cv_sl():

In cv_sl(), the validation-set SuperLearner predictions for fold i are computed with fold_fits[[1]] rather than fold_fits[[i]].

Fold 1's SL was trained on the validation rows of folds 2..V, so the "SuperLearner" row of cv_risk is scored in-sample on (V-1)/V of the observations, while the candidate learners' columns remain honestly cross-validated. As a result, the
SL's CV risk is optimistically biased relative to its candidates.

I suggest a one-line change ([[1]] -> [[i]]), matching every other line in that loop.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant