This project aims to predict the exchange rate between the US Dollar and the Nigerian Naira. Three different machine learning models were built to predict the exchange rate: linear regression, Support Vector Machine (SVM), and Artificial Neural Network (ANN). The models were trained and evaluated using historical exchange rate data from 2001 to 2022.
assets/
- Holds plot images obtained during the study.datasets/
- Holds the dataset used in the study.production/
- Holds Django files that enables prediction in a live environmentproduction/artifcats/
- Holds contents of the compiled model.production/templates
- Holds html files used in the web environment.production/static
- Holds CSS files used in the web environment.production/RequestHandler
- Holds files that interface with the prediction functions.
To run the notebook, you need to have Visual Studio Code or Jupyter Notebook installed on your computer. On Visual Studio Code, use the Jupyter
extension from Marketplace to power up a kernel.
The following packages are required to run the notebook:
- pandas
- matplotlib
- sklearn
- keras
You can install all of the required packages by running the following command in your terminal:
pip install -r requirements.txt
The performance of each model was evaluated using the R2 Score metric. The higher the score, the better the model's performance.
The following figures show the actual exchange rates vs. predicted exchange rates for each model:
To enable real-time predictions, the model artifacts are served in an environment powered by Django and Jinja's Template engine. To deploy the web environment locally, switch to production
folder and start the web server:
cd production
python manage.py runserver
Server Log:
In a browser window, open the specified address (http://127.0.0.1:8000), specify the model to be used for prediction and passing the value to be predicted for
And there you have a successful prediction!
Overall, the best model for predicting the dollar to naira exchange rate was the Artficial Neural Network (ANN) model, with a R2 score of 96.66%. The Support Vector Machine (SVM) model had a R2 score of 95.50%, while the linear regression model had a a R2 score of 78.92%