You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (class(NewResults) %in% c("simpleError","Error","condition")) {
209
-
er<- conditionMessage(NewResults)
210
-
if (verbose>0) {
211
-
cat(returnEarly("\nAn error occured in FUN:",er))
212
-
cat(returnEarly(" If this error is about inconsist column counts, it may mean that FUN failed in at least 1, but not all runs."))
213
-
cat(returnEarly(" If you can verify that this is not an error in FUN, please submit an issue to: https://github.com/AnotherSamWilson/ParBayesianOptimization/issues."))
214
-
cat(returnEarly(" Returning results so far."))
215
-
}
216
-
optObj$stopStatus<- paste0("Error in FUN: ",er)
217
-
optObj$elapsedTime<- totalTime(optObj,startT)
218
-
return(optObj)
219
-
} elseif(class(NewResults) =="matrix") {
220
-
# foreach returns a matrix of errors if running FUN >1 times.
221
-
cat(returnEarly("\nFUN returned all errors: ",NewResults[1,]$message,"."),sep="")
222
-
optObj$stopStatus<- paste0("Error in FUN: ",NewResults[1,]$message)
223
-
optObj$elapsedTime<- totalTime(optObj,startT)
224
-
return(optObj)
225
-
}
226
-
227
-
}
223
+
if (verbose>0) cat("",tm,"seconds\n")
228
224
229
225
# Print updates on parameter-score search
230
226
if (verbose>1) {
@@ -260,9 +256,14 @@ addIterations <- function(
260
256
# Plotting
261
257
if(plotProgress) plot(optObj)
262
258
263
-
}
259
+
# Check for change in stop status before we continue.
Copy file name to clipboardExpand all lines: R/applyNoise.R
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ applyNoise <- function(
9
9
tries<-1
10
10
noiseAdd<-0.04
11
11
12
-
while(tries<=95) {
12
+
while(TRUE) {
13
13
14
14
noiseAdd<-noiseAdd+0.01
15
15
@@ -31,9 +31,15 @@ applyNoise <- function(
31
31
32
32
# If we have tried enough times, return a message to stop the process early and return results so far.
33
33
if (tries>=100) {
34
-
msg<-"\n\nCould not apply noise to get enough random new parameter sets. Increase noiseAdd or decerase bulkNew. Stopping process and returning results so far."
35
-
class(msg) <-"stopEarlyMsg"
36
-
return(msg)
34
+
return(
35
+
makeStopEarlyMessage(
36
+
paste0(
37
+
"Stopping process and returning results so far. "
38
+
, "Could not apply noise to get enough random new parameter sets. "
39
+
, "This happens if all of your parameters are integers. Try decreasing iters.k"
if (toupper(substr(saveFile, nchar(saveFile)-4+1, nchar(saveFile))) !=".RDS") stop("saveFile is saved as an RDS using saveRDS() - please change file extension in saveFile parameter.")
16
-
if (file.access(saveFile,mode=2) !=0) {
17
-
message("saveFile is not writeable according to file.access(). Continue? [y/n]")
18
-
line<- readline()
19
-
if (tolower(line) =="y") invisible() else stop("Process Stopped by User.")
0 commit comments