I have made an H2O model to predict the values of varToBePredicted
:
data <- h2o.importFile(file)
split <- h2o.splitFrame(data, ratios = c(.70, .15))
gbm <- h2o.gbm(
training_frame = split[[1]],
validation_frame = split[[2]],
x = c(setdiff(names(data), allExceptThis)),
y = 'varToBePredicted',
ntrees = 1000,
max_depth = 2)
model_path <- h2o.saveModel(object = gbm, path = getwd(), force=TRUE)
When I print the R2
of this program by
print(h2o.r2(h2o.performance(gbm, newdata=split[[3]])))
I get a R2
value of 0.85
. But my question is: How can I add the predicted values of varToBePredicted to data
(which is a data.table
)? I want this so that I can plot the observed values vs the predicted values.