Coder Social home page Coder Social logo

whysirier / tgcn_lstm_for_crypto_forecasting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nikgeokar/tgcn_lstm_for_crypto_forecasting

0.0 0.0 0.0 57.42 MB

This repository contains code and notebooks for a project focused on cryptocurrency price prediction. The project aims to explore and compare different machine learning approaches, including graph neural networks (GNNs) and Long Short-Term Memory (LSTM) models, to forecast cryptocurrency prices accurately.

Jupyter Notebook 100.00%

tgcn_lstm_for_crypto_forecasting's Introduction

Cryptocurrency Forecasting with LSTM and Dynamic GNN

This repository contains code and notebooks for a project focused on cryptocurrency price prediction. The project aims to explore and compare different machine learning approaches, including graph neural networks (GNNs) and Long Short-Term Memory (LSTM) models, to forecast cryptocurrency prices accurately.

1

Acknowledgments

Introduction

  • Cryptocurrency popularity necessitates accurate forecasting. There is a growing interest in cryptocurrencies as investment options.
  • There is high volatility in cryptocurrency prices.
  • Deep learning addresses volatility and nonlinear patterns.
  • LSTM and GNN models improve prediction accuracy.
  • Dynamic graphs with directed edges are used.
  • A constructive evaluation method is employed.
  • This empowers informed decision-making in the cryptocurrency market
  • Inovation

  • The proposed approach to the problem is entirely novel, as only one existing work utilizes graph neural networks for cryptocurrency price prediction
  • In that work, the graph structure remains fixed, and the correlations between cryptocurrencies remain unchanged over time.
  • However, this approach does not reflect real-life scenarios. Therefore, we employed dynamic graphs to capture the evolving correlations and investor behavior.
  • Proposed Method

  • Incorporating core financial indicators, time-related features, and categorical variables.
  • Proposing two different architectures: LSTM and GNN+LSTM.

  • LSTM:
  • Training one LSTM network for each cryptocurrency to capture the unique patterns and characteristics of a specific cryptocurrency.
  • The proposed LSTM architecture combines LSTM layers to capture long-term dependencies in historical price data.
  • It is followed by fully connected layers to capture complex relationships and includes dropout and batch normalization for overfitting prevention.

  • GNN+LSTM:
  • Utilizing the TGCN2 architecture based on graph neural networks.
  • Spatializing the problem by using graphs and converting each cryptocurrency into a node.
  • Constructing dynamic graph datasets with a temporal signal to capture changing relationships.
  • Constructing directed edges using the Granger causality test to capture predictive relationships between cryptocurrencies.
  • The GNN+LSTM architecture combines a GNN with a Bidirectional LSTM applied to the spatial dimension.
  • Dataset

  • The dataset encompasses the price history from 2021 to March 2023, consisting of 8,000 timesteps recorded at 4-hour intervals.
  • The dataset was divided into three sets for training (5,370 data points), validation (2,005 data points), and testing (622 data points).
  • Information on eight prominent cryptocurrencies is included: ADA, BNB, BTC, DASH, ETH, LINK, LTC, and XRP.
  • Key features such as high-low values, open-close values, and volume are available for each cryptocurrency.
  • Project Structure

    The project is divided into several notebooks, each serving a specific purpose:

    Data_preprocessing.ipynb: This notebook focuses on loading the raw data and preprocessing it to ensure it is in a suitable format, specifically a Pandas dataframe. The preprocessed data will serve as input for the subsequent notebooks. Graph_Construction.ipynb: In this notebook, the data that has been transformed into a tabular format by the previous notebook is further processed to be in a suitable format for graph neural networks. The notebook handles the conversion of the data into an appropriate input format for graph-based models.

    TGCN_model.ipynb: This notebook revolves around training and evaluating multiple architectures of graph neural networks. The focus is on implementing Temporal Graph Convolutional Networks (TGCN) and exploring their performance for the given task.

    LSTM_model.ipynb: This notebook is dedicated to training and evaluating LSTM (Long Short-Term Memory) neural networks. The emphasis is on implementing and assessing the performance of LSTM models for the project.

    Comparison_Popular_ML_Algo.ipynb: In this notebook, a variety of commonly used state-of-the-art machine learning algorithms are trained and evaluated. The goal is to conduct a fair comparison between these popular algorithms and the proposed method in the project.

    Backtesting.ipynb: This notebook focuses on implementing a backtesting technique, which involves applying the trained models to real-life scenarios. The notebook explores how well the models perform in practical situations and evaluates their effectiveness. Prerequisites

    Usage

    To get started with the project, follow these steps:

    Clone this repository to your local machine. Install the required dependencies using pip install -r requirements.txt. Run the notebooks in the specified order to preprocess the data, train different models, compare algorithms, and perform backtesting. Feel free to explore the code, experiment with different approaches, and modify the notebooks to suit your needs.

    tgcn_lstm_for_crypto_forecasting's People

    Contributors

    nikgeokar avatar giorgos1808 avatar

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google โค๏ธ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.