Code Monkey home page Code Monkey logo

blackcol / prediction-bitcoin-price-with-gated-recurrent-unit-rnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rifkyahmadsaputra/prediction-bitcoin-price-with-gated-recurrent-unit-rnn

0.0 0.0 0.0 1.73 MB

In this project, I created prediction model for predict bitcoin price with Gated Recurrent Unit Model. GRU is a gating mechanism in recurrent neural networks (RNN) similar to a long short-term memory (LSTM), GRU have more simple computation and faster than LSTM because have fewer number of gates.

Jupyter Notebook 100.00%

prediction-bitcoin-price-with-gated-recurrent-unit-rnn's Introduction

Prediction Bitcoin Price with Gated Recurrent Unit (RNN)

Introduction

      In this project I created prediction model for predict bitcoin price with Gated Recurrent Unit Model. GRU is a gating mechanism in recurrent neural networks (RNN) similar to a long short-term memory (LSTM), GRU have more simple computation and faster than LSTM because have fewer number of gates.

      Dataset used in this model prediction is bitcoin price from 2014 to 2020 were recorded every day. I obtained dataset from kaggle, you can check dataset in this link : https://www.kaggle.com/khalilbrick/bitcoin-data-from-2014-to-2020. Prediction results from the prediction model will evaluate with RMSE and MAPE, to find out how optimal that the prediction models.

Results

      Results from prediction model for predict bitcoin price with Gated Recurrent Unit Model is quite good, the model can predict bitcoin price well. The following is a model loss from model that I built :



Model loss

      Can be seen from the picture above, train and val loss are not fluctuating and overfitting, so it can be said the model prediction can predict bitcoin price quite well. After the model is compiled, that model will be implemented on test set which has been partitioned before.Then, evaluate the prediction model with RMSE and MAPE



Root Mean Square Error and Mean Absolute Percentage Error

      Based on the results obtained, the model is quite good in making predictions of bitcoin, with result of RMSE is 1994.7004 and MAPE is 18.5992% (Accuracy : 81.4%). After that, here is a table and graph from comparing the results of prediction with actual test data

Table comparasion data actual and data prediction





Graph comparasion data actual and data prediction

      Can be seen from the graph, prediction results can can follow the movement from test set. But, there are some points of prediction result which is quite big different from the actual sets (for example at the first or initial data point).


Summary

The following is a summary of what was done in this project:

- Data Preprocessing

      First, import some libraries that will be used and store data into dataframe



Informations of data

      Based on picture above, we know dataset contains 2123 rows data and 6 columns. It can be seen that the dataset is fairly clean and also has no null values. After that, I do features selection, features I used in this model prediction is ‘Date’ and ‘Close’ which can represent bitcoin price movements every day.



Bitcoin price graph

      Afterthat, I do min-max normalization and data partition. Dataset separated into 3 partitions that is training, validation and test sets with composision : 70% for training, 10% for validation and 20% test sets.



Training data graph



Validation data graph



Test data graph

      Afterthat, I change format dataset from sequential into sliding windows format. In this prediction model, I used the sliding windows with two lag or length.



Predict Bitcoin Price with Gated Recurrent Unit

      Prediction model architecture that implemented in this task is model prediction with three gru layer. Each layer GRU have dropout layer(the dropout rate is set to 20%) which aims to prevent overfitting on model. Then, do some evaluating for determine best hyperparameter on that model. There are best hyperparameter I used in this model prediction : - learning_rate = 0.0001

  • hidden_unit = 64

  • batch_size=256

  • epoch = 100

  • optimizers = adam

      Here is the model loss from the prediction model: :



Model loss

      Can be seen from the picture above, train and val loss are not fluctuating and overfitting, so it can be said the model prediction can predict bitcoin price quite well. After the model is compiled, that model will be implemented on test set which has been partitioned before.Then, evaluate the prediction model with RMSE and MAPE



Root Mean Square Error and Mean Absolute Percentage Error Values

      Based on the results obtained, the model is quite good in making predictions of bitcoin, with result of RMSE is 1994.7004 and MAPE is 18.5992% (Accuracy : 81.4%). After that, here is a table and graph from comparing the results of prediction with actual test data

Table comparasion data actual and data prediction





Graph comparasion data actual and data prediction

      Can be seen from the graph, prediction results can can follow the movement from test set. But, there are some points of prediction result which is quite big different from the actual sets (for example at the first or initial data point).


For details you can check my code : Prediction Bitcoin Price with Gated Recurrent Unit (RNN).ipynb

prediction-bitcoin-price-with-gated-recurrent-unit-rnn's People

Contributors

rifkyahmadsaputra 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.