2) Process Random Data Frame against Neural Network Model

This Blog entry is from the Monte Carlo Model section in Learn R.

The data frame can be used with all of the machine learning algorithms presented in this guide thus far, although to use the data frame with H2O, it needs to be loaded into H2O as hex:

To load the data frame into H2O use:

SimulatedHex <- as.h2o(SimulatedDataFrame)

Run the line of script to console:


As before, use the H2O predict function to execute the model, passing the simulated dataframe in the place of real data:

SimulatedScores <- h2o.predict(Model,SimulatedHex)

Parse the Activation to a standalone vector:

SimulatedActvations <- as.vector(SimulatedScores[1])

Run the line of script to console:


Append the vector to the simulations data frame (keeping in mind that dplyr is already loaded):

SimulatedDataFrame <-mutate(SimulatedDataFrame, SimulatedActvations)

Run the line of script to console:


Viewing the simulated data frame, scrolling to the last column:


It can be seen that the simulated dataframe has been passed through the H2O neural network as if it were production data.  The last column contains the predicted activation, in this case fraud prevention.  This data frame can now be used to describe the most likely scenario surrounding an activation.