Inthis tutorial, we’ll dive into the exciting world of stock price prediction using Long Short-Term Memory (LSTM) neural networks. LSTM is a powerful deep-learning technique for time series forecasting, making it ideal for predicting stock prices.

LSTM is just multiple copies of itself
Getting the Data
To get started, we need historical stock price data. We can obtain this data from sources like Yahoo Finance or Alpha Vantage. For this tutorial, we’ll use a dataset covering IBM’s stock prices from 2006 to 2018.
import pandas as pd
df = pd.read_csv("IBM_2006–01–01_to_2018–01–01.csv", index_col='Date', parse_dates=["Date"])
Data Visualization
Let’s visualize our dataset to understand the stock price trends. We’ll plot the training set (before 2017) and the test set (2017 and beyond) separately.