Loading the model

Now, we will try to load the saved model and use it to create predictions. MXNet implements the mx.load_checkpoint function, which requires the following set of parameters:

Please ensure that you have run the code from the previous activity so that you have all of the required files in place. We will be loading the weights for the 10th epoch:

new_nnet = mx.load_checkpoint(cp_prefix, 10, mx.FeedForward);

Now, you are ready to create the predictions:

data_array = mx.zeros((size(test_x, 1, 2)..., 10));
mx.copy!(data_array, test_x[:, :, 1:10]);
data_provider = mx.ArrayDataProvider(:data => data_array);

results = round.(mx.predict(new_nnet, data_provider; verbosity = 0), 2)

The process worked well, with predictions being stored in the results variable.