Skip to content

Commit

Permalink
check if datapoint is used for testing in more than one fold (LPD)
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-scm committed Jan 16, 2024
1 parent f4fd2bd commit 55bc355
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions R/trainDI.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ trainDI <- function(model = NA,
whichfold <- NA
if(!is.null(CVtrain)&!is.null(CVtest)){
whichfold <- as.numeric(which(lapply(CVtest,function(x){any(x==j)})==TRUE)) # index of the fold where i is held back
if(length(whichfold)>1){stop("a datapoint is used for testing in more than one fold. currently this option is not implemented")}
if(length(whichfold)!=0){ # in case that a data point is never used for testing
DItrainDist[!seq(nrow(train))%in%CVtrain[[whichfold]]] <- NA # everything that is not in the training data for i is ignored
}
Expand Down

0 comments on commit 55bc355

Please sign in to comment.