Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
lhjohn committed Oct 6, 2023
1 parent 216c7af commit 2220ff2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions R/Estimator.R
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ gridCvDeep <- function(mappedData,
)

# remove all predictions that are not the max performance
indexOfMax <- which.max(sapply(gridSearchPredictons, function(x) x$gridPerformance$cvPerformance))
indexOfMax <- which.max(unlist(lapply(gridSearchPredictons, function(x) x$gridPerformance$cvPerformance)))
for (i in seq_along(gridSearchPredictons)) {
if (!is.null(gridSearchPredictons[[i]])) {
if (i != indexOfMax) {
gridSearchPredictons[[i]]$prediction <- NULL
gridSearchPredictons[[i]]$prediction <- list(NULL)
}
}
}
Expand All @@ -389,7 +389,7 @@ gridCvDeep <- function(mappedData,
paramGridSearch <- lapply(gridSearchPredictons, function(x) x$gridPerformance)

# get best params
indexOfMax <- which.max(sapply(gridSearchPredictons, function(x) x$gridPerformance$cvPerformance))
indexOfMax <- which.max(unlist(lapply(gridSearchPredictons, function(x) x$gridPerformance$cvPerformance)))
finalParam <- gridSearchPredictons[[indexOfMax]]$param

# get best CV prediction
Expand Down
3 changes: 1 addition & 2 deletions R/TrainingCache-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ TrainingCache <- R6::R6Class(
private = list(
.paramPersistence = list(
gridSearchPredictions = NULL,
modelParams = NULL,
gridPerformance = NULL
modelParams = NULL
),
.paramContinuity = list(),
.saveDir = NULL,
Expand Down

0 comments on commit 2220ff2

Please sign in to comment.