Skip to main content

A package for price forecasting using LSTM networks

Project description

Foresight Build Status Documentation Status


Foresight is a collection of tools built in Python 3 to forecast the future price movements of industrial metals, using Long Short Term Memory networks. It can take univariate or multivariate datasets and make predictions using single-input single-output (SISO), multi-input single-output (MISO) or multi-input multi-output (MIMO) frameworks.

It was built for the purpose of testing the hypothesis that improved predictive performance can be achieved by applying the multi-task learning paradigm to commodity price forecasting. As such many of the example notebooks are built for this purpose.

The tools can equally be applied to any user chosen datasets, provided the datasets are loaded in the format shown in the example csvs, or are inputed directly as shown in the "generic" notebooks.


Full documentation can be found on

Read the docs will not show the models module online. For more information on the models module refer to the PDF Documentation1

Foresight is hosted on PyPi under ForesightPy:

Repository Structure

  • Docs - Contains all files relating to the documentation

  • Foresight - Contains the collection of python files relating to Foresight

  • Data - Contains the time series used to forecast industrial metals prices

  • Notebooks - Contains example notebooks for SISO, MISO and MIMO regression

  • Results/Pths - Contains saved model weights2

  • Results/Pickles - Contains saved deeplearning objects3

  • Results/Plots - Contains images of predictions and training/val losses

  • Tuning - Contains python files that can be used to hyper-parameter tune the networks


Continuous integration best practices has been utilized, using Travis CL. With the tests methodology used being unit testing written deveoped using the Pytest library.

Relevant Author and Course Information

Author: Oliver Boom Github: OliverJBoom CID: 01593306

This collection of tools was built as part of the Applied Computational Science & Engineering MSc, completed at Imperial College London. It forms a composite part of the Independent Research Project (Module Code: ASCE9) and was conducted under the supervision of Dr Stephen Neethling. This project is also understaken in partnership with Commodities AI (ChAI), under the supervision of Dr Tristan Fletcher.

With the exception of parts of the ChaiDB class (the init, get_instrument_data, close_db_connection and get_list_datascope_instruments functions), all of the work contained within this repository is my own.


Foresight is licensed under the MIT license. See LICENSE.


1 Pytorch is too heavy a dependency for Read the Docs Docker containers. And so requires mocking when passing through the Sphinx autodocumentation. However, inheritance from mocked classes is not supported. It is a known issue in Read the Docs.

2 For loading pickle and pths it requires the DeepLearning and LSTM classes to be identical to the version at the time of initialisation. Many of the experiments were completed and then minor updates to these classes were made, this means that it is not recommended to try and load the pickle/pth files. They were kept for record and if the classes were matched to the version at the time of commit then they can be loaded. But it is more trouble then it is worth to reload these old experiments, and the user is better of retraining that model if it is particurly desired. Going forwards the saving/loading functionality can be used as no changes to the DeepLearning or LSTM classes is planned.

3 As is explained in the deeplearning documentation. It is a pre-requisite of Pytorch's serialization routines that pickled files and model pths are loaded in the same computational environment as they are created. So the pickled files in this folder must be loaded in the same computational configuration as they were initialized on (in terms of processing units and parallelisation framework).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ForesightPy, version 1.0.11
Filename, size File type Python version Upload date Hashes
Filename, size ForesightPy-1.0.11.tar.gz (16.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page