Skip to content

Commit

Permalink
Merge pull request #3362 from sambhavnoobcoder/CreateFolds->.CreateFolds
Browse files Browse the repository at this point in the history
 Update create_folds -> .create_folds
  • Loading branch information
mdietze authored Aug 23, 2024
2 parents bb2cda9 + 181cf76 commit 04c8482
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/assim.sequential/R/downscale_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SDA_downscale_preprocess <- function(data_path, coords_path, date, carbon_pool)
}

##' @title Create folds function
##' @name create_folds
##' @name .create_folds
##' @author Sambhav Dixit
##'
##' @param y Vector. A vector of outcome data or indices.
Expand All @@ -76,7 +76,7 @@ SDA_downscale_preprocess <- function(data_path, coords_path, date, carbon_pool)
##'
##' @return A list of k elements (if list = TRUE), each containing indices for a fold, or a vector of indices (if list = FALSE).

create_folds <- function(y, k, list = TRUE, returnTrain = FALSE) {
.create_folds <- function(y, k, list = TRUE, returnTrain = FALSE) {
n <- length(y)
indices <- seq_len(n)
folds <- split(indices, cut(seq_len(n), breaks = k, labels = FALSE))
Expand Down Expand Up @@ -184,7 +184,7 @@ SDA_downscale <- function(preprocessed, date, carbon_pool, covariates, model_typ
all_models <- list()

# Create k-fold indices
fold_indices <- create_folds(y = seq_len(nrow(x_train)), k = k_folds, list = TRUE, returnTrain = FALSE)
fold_indices <- .create_folds(y = seq_len(nrow(x_train)), k = k_folds, list = TRUE, returnTrain = FALSE)

#initialise operations for each fold
for (fold in 1:k_folds) {
Expand Down

0 comments on commit 04c8482

Please sign in to comment.