Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to save predicted values of H2O.GBM in an existing dataframe?

$
0
0

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.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>