Compiling and fitting the model

Next, we will compile and fit the model using the following code:

# Compile model
ae_model %>% compile( loss='mean_squared_error', optimizer='adam')

# Fit model
model_one <- ae_model %>% fit(trainx, trainx, epochs = 20, shuffle=TRUE, batch_size = 32, validation_data = list(testx,testx))

Here, we compile the model using mean squared error as the loss function and specify adam as the optimizer. For training the model, we will make use of trainx as the input and output. We'll use textx for validation. We fit the model with a batch size of 32 and use 20 epochs.

The following output shows the plot of the loss values for the train and validation data:

The preceding plot shows good convergence and doesn't show any signs of overfitting.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset