Darren Cook Darren Cook - 1 month ago 6x
R Question

How do know how many deep learning epochs were done, from R?

Early stopping is turned on by default for

. But, from R, how do I find out if it did stop early, and how many epochs it did? I've tried this:

model = h2o.deeplearning(...)

which tells me information on the layers, the MSE, R2, etc. but nothing about how many epochs were run.

Over on Flow I can see the information (e.g. where the x-axis stops in the "Scoring History - Deviance" chart, or in the Scoring History table).


If your model is called m, then to get just the number of epochs trained: last(m@model$scoring_history$epochs)

To see what other information is available (which is literally everything you can see in the Flow interface) and how to access it, use str(m)

Also be aware of this command: summary(m) In addition to what is shown with print(m) it adds this section (for a deeplearning model):

Scoring History: 
            timestamp   duration training_speed    epochs iterations       samples training_MSE training_deviance training_r2
1 2016-04-14 11:35:46  0.000 sec                  0.00000          0      0.000000
2 2016-04-14 11:35:52  5.218 sec 15139 rows/sec  10.00000          1  77150.000000      0.00000           0.00000     0.07884
7 2016-04-14 11:36:18 31.346 sec 25056 rows/sec 100.00000         10 771500.000000      0.00000           0.00000     0.72245

I.e. You can see total number of epochs by looking at the last row.

BTW, this is different to h2o's summary() command when applied to a data frame; in that case it behaves like R's built-in summary function, and shows statistics on each column in the data frame.