Skip to content

This project uses RNN(LSTM) to make predictions about the forex exchange between USD and Euro.

License

Notifications You must be signed in to change notification settings

rishabh01solanki/RNN-Forex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forex Price Forecasting Using Recurrent Neural Networks (RNNs)

This project focuses on the application of Recurrent Neural Networks (RNNs), specifically Long Short-Term Memory (LSTM) networks, to forecast foreign exchange (Forex) prices. RNNs have the capability to remember sequences, making them ideal for time-series data like Forex rates.

RNN Architecture

Table of Contents

  1. Libraries and Tools
  2. Data Preprocessing and Feature Engineering
  3. Model Architecture
  4. Evaluation Metrics
  5. Interactive Data Visualization
  6. Code Implementation

Libraries and Tools

  • numpy: For array manipulations and mathematical operations.
  • pandas: For data ingestion, manipulation, and dataframes.
  • matplotlib: For generating static plots and data visualizations.
  • plotly: For creating interactive charts and figures.
  • scikit-learn: For preprocessing data and scaling features.
  • tensorflow: For designing, training, and evaluating the neural network.

Data Preprocessing and Feature Engineering

Data Source and Attributes

The dataset spans from 2020 to 2023, capturing various aspects of Forex rates such as the opening, highest, lowest, and closing prices over different intervals.

Data Loading

Data is read into Pandas dataframes and initial inspections are performed to understand the shape, size, and data types of the attributes.

Data Scaling

A feature scaling step normalizes the feature set using Min-Max scaling, ensuring that the values lie in a similar range. This is critical for the efficient training of neural networks.

Time-Series Transformation

The data is then transformed into sequences that represent the Forex rates at different time intervals. Each sequence consists of 60 time steps, which act as the features for training the model.

Model Architecture

The neural network used in this project is a specific type of RNN known as Long Short-Term Memory (LSTM). It consists of three LSTM layers followed by a dense output layer.

Layer Details

  • The first LSTM layer has 50 units and returns sequences to match the input shape.
  • The second LSTM layer also has 50 units and returns sequences.
  • The third LSTM layer has 50 units but does not return sequences.
  • The dense layer has one unit, corresponding to the output feature, which is the Forex rate at the next time interval.

Evaluation Metrics

Mean Squared Error

The model's performance is assessed using the Mean Squared Error (MSE) which is a measure of the average of the squares of the errors between the predicted and actual values.

Interactive Data Visualization

Post-training, the model's predictions are plotted alongside the actual data points using Plotly, providing an interactive way to assess model performance. The Plotly graph supports zooming, panning, and hovering over data points, allowing for a thorough examination of the model's accuracy.

Code Implementation

To run the code, a well-structured CSV file with Forex rates is needed. The file_path in the code should be updated to point to this file. All required Python packages can be installed using pip:

pip install numpy pandas matplotlib plotly scikit-learn tensorflow

About

This project uses RNN(LSTM) to make predictions about the forex exchange between USD and Euro.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages