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
Example code results in hard crash only when "blackboost" is included.
Parallel and sequential crash. "memory could not be written. Click on OK to terminate".
require(caret)
require(gbm)
require(randomForest)
# load iris set
data(iris)
dim(iris)
m<- c("rf" ,"gbm","blackboost")
# load X and Y (this will be transferred to to train function)X=iris[,1:3]
Y=iris$Species# register parallel front-end
library(doParallel); cl<- makeCluster(detectCores()); registerDoParallel(cl)
# this setup actually calls the caret::train function, in order to provide# minimal error handling this type of construct is needed.trainCall<-function(i)
{
cat("----------------------------------------------------","\n");
set.seed(123); cat(i," <- loaded\n");
return(tryCatch(
t2<- train(y=Y, x=X, (i), trControl= trainControl(method="cv")),
error=function(e) NULL))
}
# use lapply/loop to run everything, required for try/catch error function to workt2<- lapply(m, trainCall)
#remove NULL values, we only allow succesful methods, provenance is deleted.t2<-t2[!sapply(t2, is.null)]
# this setup extracts the results with minimal error handling # TrainKappa can be sometimes zero, but Accuracy SD can be still available# see Kappa value http://epiville.ccnmtl.columbia.edu/popup/how_to_calculate_kappa.htmlprintCall<-function(i)
{
return(tryCatch(
{
cat(sprintf("%-22s",(m[i])))
cat(round(getTrainPerf(t2[[i]])$TrainAccuracy,4),"\t")
cat(round(getTrainPerf(t2[[i]])$TrainKappa,4),"\t")
cat(t2[[i]]$times$everything[3],"\n")},
error=function(e) NULL))
}
r2<- lapply(1:length(t2), printCall)
# stop cluster and register sequntial front end
stopCluster(cl); registerDoSEQ();
Example code results in hard crash only when "blackboost" is included.
Parallel and sequential crash. "memory could not be written. Click on OK to terminate".
The text was updated successfully, but these errors were encountered: