Making predictions

Our model is now ready for use. We can therefore use it to execute our predictions:

trainPred = model.predict(trainX)testPred = model.predict(testX)

The predict() module has been used, which generates output predictions for the input samples. Computation is done in batches. A Numpy array of predictions is returned. Previously, when data scaling was performed, we used the fit_transform() function. As we said, this function is particularly useful as it stores the transformation parameters used. These parameters will be useful when, after having made the forecasts, we will have to report the data in the initial form (before normalization), to compare it to the actual data. In fact, now the predictions must be reported in original ...

Get Hands-On Machine Learning on Google Cloud Platform 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.