Step2: Loading the Dataset
In this step, we are using ‘yfinance’ library to download historical stock market data for Apple Inc. (AAPL) from Yahoo Finance.
Python3
# Loading the Apple.Inc Stock Data import yfinance as yf from datetime import date, timedelta, datetime end_date = date.today().strftime( "%Y-%m-%d" ) #end date for our data retrieval will be current date start_date = '1990-01-01' # Beginning date for our historical data retrieval df = yf.download( 'AAPL' , start = start_date, end = end_date) # Function used to fetch the data |
Output:
[*********************100%%**********************] 1 of 1 completed
Time Series Forecasting using Pytorch
Time series forecasting plays a major role in data analysis, with applications ranging from anticipating stock market trends to forecasting weather patterns. In this article, we’ll dive into the field of time series forecasting using PyTorch and LSTM (Long Short-Term Memory) neural networks. We’ll uncover the critical preprocessing procedures that underpin the accuracy of our forecasts along the way.
Table of Content
- Time Series Forecasting
- Implementation of Time Series Forecasting:
- Step 1: Import the necessary libraries
- Step2: Loading the Dataset
- Step 3: Data Preprocessing
- Step 4: Define LSTM class model
- Step 5: Creating Data Loader for batch training
- Step 6: Model Training & Evaluations
- Step 7: Forecasting