Step 9 - Pre-trained supervised model

We can now try using the autoencoder model as a pre-training input for a supervised model. Here, I am again using a neural network. This model will now use the weights from the autoencoder for model fitting. However, transforming the classes from Int to Categorical in order to train for classification is necessary. Otherwise, the H2O training algorithm will treat it as a regression:

toCategorical(train_supervised, 29)

Now that the training set (that is, train_supervised) is ready for supervised learning, let's jump into it:

val train_supervised_H2O = asH2OFrame(train_supervised)        dlParams = new DeepLearningParameters()        dlParams._pretrained_autoencoder = model_nn._key dlParams._train = train_supervised_H2O ...

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.