Member-only story
How to use Tensorflow’s Long Short Term Memory to make predictions on car sales
In an earlier blog post I reviewed a YouTube video created by Krish Naik, where he coded a long short term memory model to make predictions on univariate time series data. In this post I intend to elaborate on that review by further analysing the code. One thing that I did do was to make some modifications to the code that Krish wrote so that any number of univariate datasets can be used with the model.
I have written the program in Google Colab, which is a free online Jupyter Notebook hosted by Google. This is a great platform to use because it can be accessed from any computer that has internet access, but its one drawback is that it does not have a sufficient undo function. Care needs to be taken, therefore, not to accidentally overwrite or delete valuable code.
When I created the program, I imported the libraries that would be needed to execute the program, being:-
- Numpy to create numpy arrays and carry out mathematical computations,
- Pandas to create dataframes and process data,
- Tensorflow to create the neural network, and
- Matplotlib to visualise the data.
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.keras.models import…