7) Recalling a Neural Network with R

This Blog entry is from the Deep Learning section in Learn R.

Once a model is trained in H2O it can be recalled very gracefully with the predict() function of the H2O package.  It is a simple matter of passing the trained model and the hex dataframe to be used for recall:

Scores <- h2o.predict(Model,CVHex.hex)
1.png

Run the line of script to console:

2.png

A progress bar is broadcast from the H2O server and will be written out to the console.  To review the output, enter the object:

Scores
3.png

Run the line of script to console:

4.png

The Scores output appears similar to a matrix, but it has created a vector which details the actual prediction for a record, hence, this can be subset to a final vector detailing the predictions:

Predict <- Scores[1]
5.png

Run the line of script to console:

6.png

The Predict vector can be compared to the Dependent vector of the CV dataframe in the same manner as previous models within R to obtain Confusion Matrices as well a ROC curves.