O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running predictions for the test data

Next, we have similar code for the test data group. Set the grp flag to 0 to designate this is from the test group:

#run predictions on test dataset based on training modelpreds_test <- predict(model, test)preds_test$grp <- 0preds_test$totrows = nrow(preds_test)

Print a few rows from the results using the SparkR select function to extract several key columns:

head(SparkR::select(preds_test,preds_test$outcome,preds_test$prediction,preds_test$grp,preds_test$totrows)) 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required