Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ericward-noaa-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
seananderson committed Oct 18, 2023
2 parents 0cdf455 + d684123 commit 1571748
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/cross-val.R
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,11 @@ sdmTMB_cv <- function(
# Create lfo_validations + 1 folds, ordered sequentially
data$cv_fold <- 1
t_validate <- sort(unique(data[[time]]), decreasing = TRUE)
for (t in seq(1, (lfo_validations + lfo_forecast - 1))) {
for (t in seq(1, lfo_validations)) {
# fold id increasing order + forecast
data$cv_fold[data[[time]] == t_validate[t]] <- lfo_validations - t + 1 + lfo_forecast
}
data$cv_fold <- as.numeric(as.factor(data$cv_fold))
} else {
dd <- lapply(split(data, data[[time]]), function(x) {
x$cv_fold <- sample(rep(seq(1L, k_folds), nrow(x)), size = nrow(x))
Expand Down

0 comments on commit 1571748

Please sign in to comment.