Я хочу построить гистограмму и CI для RMSE, используя регрессию XGBoost H2O. Приведенные ниже коды являются (воспроизводимыми) и отлично работают на небольшой итерации до 100. Однако я хочу выполнить итерацию как минимум 1000, а набор данных большой. При большом количестве итераций, таких как даже 500, я получаю следующее сообщение об ошибке. Можем ли мы применить функцию lapply, чтобы сделать это быстро? или Есть ли другой способ решения этой проблемы?
Ошибка в .h2o.doSafeREST (h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,: непредвиденная ошибка CURL: пустой ответ от сервера
boston <- h2o.importFile("https://s3.amazonaws.com/h2o-public-test-data/smalldata/gbm_test/BostonHousing.csv")
# set the predictor names and the response column name
predictors <- colnames(boston)[1:13]
# set the response column to "medv"
response <- "medv"
# convert the chas column to a factor bounds river; 0 otherwise))
boston["chas"] <- as.factor(boston["chas"])
rmse=c()
for(i in 1:50){
boston.splits <- h2o.splitFrame(data = boston, ratios = c(0.6, 0.2))
train<- boston.splits[[1]]
valid<- boston.splits[[2]]
test<- boston.splits[[3]]
my_xgb1 <- h2o.xgboost(x = predictors,
y = response,
nfolds = 0,
training_frame = train,
validation_frame = valid,
stopping_tolerance = 0.005,
max_runtime_secs = 3600,
seed = 1601,
distribution = "AUTO",
tweedie_power = 1.5,
categorical_encoding = "AUTO",
quiet_mode = TRUE,
ntrees = 100,
max_depth = 6,
min_rows = 0.01,
min_child_weight = 1,
learn_rate =0.05,
grow_policy = "depthwise" ,
booster = "gbtree",
reg_lambda = 0.1,
reg_alpha = 1)
pred <- h2o.predict(my_xgb1 , test)
perf <- h2o.performance(my_xgb1, newdata = test)
rmse[i] = h2o.rmse(perf)
print(rmse)
}
mean(rmse)
ci <- quantile(rmse, c(.05, .95))
windows()
# Plot histogram of scores.
hist(rmse, density=35, main = "Test RMSE over 50 Samples", xlab = "Value of Obtained RMSE", col="blue", border="black")
abline(v=mean(rmse), lwd=3, col="red")