*Time Series Analysis of Cryptocurrencies Using Deep Learning & Fbprophet*

*Time Series Analysis of Cryptocurrencies Using Deep Learning & Fbprophet*

## Understanding various cryptocurrencies and predicting them using Machine Learning & Deep Learning

## Important Points

- This paper consists of cryptocurrency prediction and analysis using different algorithms, the major cryptocurrency took into account for analysis and prediction are Bitcoin (BTC), Ethereum (ETH), Chainlink (LINK), Bitcoin Cash (BTC), XRP (XRP).
- Prediction of cryptocurrencies is tangible and requires lots of understanding regarding the flow of money on daily basis.
- The machine learning industry has advanced to a great extent and it would further do, this advancement has led us to a bigger problem-solving technique, that is prediction of data or analysis of trend which can be in any format.
- The algorithms used for such analysis is LSTM (Long Short-Term Memory) which is part of Deep Learning and further Fbprophet which is an Auto Machine Learning for prediction is used.
- The metric used for the analysis of the algorithm is MAE (Mean Absolute Error). The programming language used is Python, which solves the majority of use cases.

## INTRODUCTION

Artificial Intelligence is the root of both machine learning & deep learning, machine learning is a subset of artificial intelligence and deep learning is a subset of machine learning in that flow. Deep learning plays an important role in the advancement of artificial intelligence in many ways, using such an important feature for the prediction of data on daily basis gives better results and also helps in the understanding of various neglected sides. The cryptocurrency has been evolved and grown to a very large amount, estimating to a billion-dollar industry. Understanding such huge digital currency is difficult and also to estimate the change in trend is important, as a change in trend can lead to profit or loss of a particular cryptocurrency. The number of cryptocurrencies over the year has increased with new currency coming out, this introduction of digital currency can tell the demand of them in the market, due to the non-presence of such currency it becomes difficult to track the change, this is where deep learning would come in handy. Deep Learning not only predicts the high-low of any currency but tells the change in trend over the month, week, or day depending on the datasets provided. Time series analysis has been used for analyzing different digital currencies and providing estimation based on the daily report of a particular currency. The cryptocurrency used is Bitcoin (BTC), Ethereum (ETH), Chainlink (LINK), Bitcoin Cash (BTC), XRP (XRP). These currencies have different values based on the popularity of each cryptocurrency; estimation of these values may vary depending on each one of them. The deep learning algorithm used for the analysis of such digital currency is LSTM, it stands for Long Short-Term Memory which is a special RNN (Recurrent Neural Network). Unlike the feed-forward neural network, the LSTM has a feedback connection which makes it special. The other automatic forecasting procedure used is Fbprophet which is an auto machine learning for prediction of data based on events, which fits the datasets based on a linear model, that can shift the model to nonlinear or logistics growth with tweaking of arguments.

## LITERATURE REVIEW

Digital currency has been increased over the past years, following the trend back to the year it started, it can be observed that cryptocurrencies got bigger and bigger with huge market values. Analysis of this cryptocurrency with precise prediction is important to keep up with the growing industry. The time series analysis plays an important role which can be tracked back when the paper “Forecasting cryptocurrency prices time series using machine learning approach.”, was published in the year 2019 by Derbentsev, Vasily, it showed a significant change in the understanding of market values for cryptocurrency, which cleared all the doubts related to the machine learning concept [3]. The flow of such information was useful for making the base stronger with understanding the concepts. The other paper “Forecasting cryptocurrency returns and volume using search engines.”, was published in the same year that was 2019, which showed the cryptocurrency price forecasting with the volume as a category using a search engine. This cleared the concepts of various trends related to the digital currency and as volume was directly related to the increase in price or vice-versa. Machine Learning plays an important role in the better understanding of concepts related to artificial intelligence, that can be submerged with the use of Deep Learning [7]. This particular concept of analysis deep learning for the forecasting of data based on various algorithms was cleared with the paper that was “Ensemble Deep Learning Models for Forecasting Cryptocurrency Time-Series.”, which was published in the year 2020 [4]. This particular research paper used the concept of deep learning for the analysis of time series for cryptocurrency. Deep Learning concept can be difficult with approach related to different algorithms that may differ from machine learning, it is important to build a proper model that may depict the values for the change related to series of dates, this particular helped in the understanding of such important criteria. The other approach that was related to the auto-machine learning algorithm that was used to cover the problem related to seasonality, this problem was important to overcome the time series prediction of data [1]. The paper published as “Software defect trend forecasting in open-source projects using a univariate ARIMA model and Fbprophet.”, solved the queries related to the particular model that was published in 2020 [5].

## METHODOLOGY

This section of the article deals with different methods used to obtain the desired outputs which are explained in the experimental results. The methodology is divided into 2 sub-sections that are:

**Long Short Term Memory Algorithm**

Recurrent Neural Network is called RNN which is a Feedback Neural Network, that gives the input to the neurons where there are different hidden layers and processes it for a particular output defined by the use case. There are different types of Feedback Neural Networks and one such is the RNN. The basic difference between the normal neural network and the recurrent neural network is that the basic neural network learns from the training data and determines the output triggered by the activation functions, whereas recurrent neural networks do the same as they learn from the training data and also from the outputs generated by the inputs, this is an additional feature that makes the particular algorithm useful. The best version of Recurrent Neural Network is LSTM which stands for Long Short-Term Memory, this version of RNN is used for solving problems related to Vanishing & Exploding Gradients, the Long Short-Term Memory Network is one of the most popular networks used which uses the concept same as Recurrent Neural Network, where it understands the information which is most useful for the particular use case and discards the information which is not useful.

**Fbprophet**

Fbprophet is an auto machine learning package, that helps to predict the data using seasonality which can be based on daily, weekly, monthly & yearly. The seasonality can be something that the data observers recurring after a particular time, the example that can suit best for the seasonality is the change in Ice-cream sales during the winters & the summers. This is important for fitting the data at its best. Fbprophet can be used to fit as well as predict the data based on any seasonality and later used to obtain the components for such prediction, that can be changed in the trend of data based on weekly change, monthly change & daily change. The Equation for the Fbprophet forecasting can be understood by (1), this shows different components of the equations.

y(t) = g(t)+h(t)+s(t)+et (1)

The following components of Fbprophet for fitting of dates are as follow

y(t) = Additive Regressive Model

g(t) = Trend Factorh

(t) = Holiday Components

(t) = Seasonality Component

et = Error Term

## EXPERIMENTAL RESULTS

The experimental section of this research paper consists of various tests and results obtained by performing iterations. This paper consists of an analysis of cryptocurrency based on time series data which was extracted using JSON in python by web-scraping the data from, Coin Market. The steps followed for the time series analysis can be understood in Fig below.

The main steps involved for cryptocurrencies price prediction were

Data Preprocessing:It was the part where cleaning of data and selection of parameters important for analysis were taken into consideration.

Construction & Decomposing Time Series:It was where the use case related to analysis, was taken into consideration. The important sub-factors involved in these steps were, Daily, Weekly, Monthly & Yearly selections.

Building Model:This step involved the creation of a model based on selected parameters for the prediction of data.

Prediction:This final step involved the prediction of the model based on testing data and understanding how it performed.

The datasets were bifurcated into training & testing with an 80–20 ratio, 80 % was for the training purpose, and the remaining 20 % was for testing purposes.

The algorithm used for the time series analysis is LSTM which is a smart RNN, this particular model is considered because of its feedback capability. The long Short-Term Memory model was created based on different parameters, the parameters that were included in this neural network are Input Layer, Hidden Layer & the Output Layer, the summary for the model created in time series analysis can be seen in Fig below.

It can be observed that the sequential model has 1-layer for the input with 100 input nodes that are connected to the dropout layer of 0.2 to avoid the overfitting of the model which is densely connected to the last layer which has the activation function as Linear. The optimizer used for the model was Adam & the loss function respectively was MSE (Mean Squared Error). The model was fitted for the training data with epochs of 20 and batch size of 32 respectively. The actual data points to the predicted data points are directly proportional to the MAE (Mean Absolute Error). The Mean Absolute Error can be calculated based on the prediction, true values & total data points. The lower the MAE value, the better-predicted results are obtained and vice-versa.

The prediction for each cryptocurrency can be seen from Fig respectively, which shows the actual & the predicted plots for the different cryptocurrencies based on the training data and understanding of the model, that was trained for analysis.

The other approach for the time series analysis was based on Fbprophet which is an auto machine learning algorithm to work with the seasonality of datasets. In this research, the seasonality was daily & yearly, which was used for the analysis of the trend based on the cryptocurrency’s datasets. The plot below shows the prediction of dates based on the training datasets, the period that was applied for all the predictions was of 15 days. The fig below is a plot for Bitcoin Cryptocurrency, Bitcoin Cash, Ethereum, Chainlink & XRP Cryptocurrencies respectively.

Similarly, the Fbprophet provides different components on which the trend can be analyzed, it varies from daily, monthly, weekly & yearly, which helps to avoid seasonality. Seasonality is something that occurs based on the same frequency, the best example for it would be “Price of Ice-cream in the season of summer vs the price of Ice-cream in the season of Winter”. The seasonality plots for trend analysis can be observed from fig below.

Mean Absolute Error for each cryptocurrency is the metric applied for the understanding of change in datasets based on variation, the variation is the time. The different values for error based on different datasets are responsible for the change in actual data points to that of predicted data points. This change in MAE values for training & validation datasets can be understood by Fig below.

It can be observed that in the above figure, the highest MAE validation score was achieved by Chainlink, followed by Ethereum & Bitcoin Cash. Similarly, the highest MAE Training score was achieved by Ethereum & Chainlink respectively. The higher MAE, the more difference between the actual & predicted values & vice versa.

## CONCLUSION

The study aims to understand the time series analysis of different cryptocurrencies based on the seasonality of datasets. The algorithm used for such analysis is LSTM & the other approach used is Fbprophet. The metric used for the evaluation of the score is MAE, this score was generated for all the cryptocurrencies which showed that the lower the value the better the prediction of the validation dataset. With this experiment, it was observed that the lowest error value was generated for the Bitcoin cryptocurrency that was 0.01867 followed by the Bitcoin Cash that was 0.02632. The plot based on the actual data points to that of predicted data points was identical to both the above cryptocurrencies due to the lower MAE score. This means that the trained model fitted best for both the digital currency as the error rate was low as compared to others. The other prediction approach used was the Fbprophet model which is an auto machine learning model, used for prediction and understanding the change in trend based on seasonality, the seasonality in this research was daily. This showed the prediction of every cryptocurrency for 15 days post.

## REFERENCES

[1] Catania, Leopoldo, and Stefano Grassi. “Modelling crypto-currencies financial time-series.” *Available at SSRN 3028486* (2017).

[2] Catania, Leopoldo, Stefano Grassi, and Francesco Ravazzolo. “Predicting the volatility of cryptocurrency time-series.” *Mathematical and Statistical Methods for Actuarial Sciences and Finance*. Springer, Cham, 2018. 203–207.

[3] Derbentsev, Vasily, et al. “Forecasting cryptocurrency prices time series using machine learning approach.” *SHS Web of Conferences*. Vol. 65. EDP Sciences, 2019.

[4] Livieris, Ioannis E., et al. “Ensemble Deep Learning Models for Forecasting Cryptocurrency Time-Series.” *Algorithms* 13.5 (2020): 121.

[5] Shrove, Michael Thomas, and Emil Jovanov. “Software defect trend forecasting in open source projects using a univariate ARIMA model and FBProphet.” *Int. J. Softw. Eng.* 8.1 (2020): 1–15.

[6] Mazed, Mashtura. *Stock price prediction using time series data*. Diss. Brac University, 2019.

[7] Adur Kannan, Bhuvana, et al. “Forecasting Spare Parts Sporadic Demand Using Traditional Methods and Machine Learning-a Comparative Study.” *SMU Data Science Review* 3.2 (2020): 9.

[8] Mensi, Walid, Khamis Hamed Al-Yahyaee, and Sang Hoon Kang. “Structural breaks and double long memory of cryptocurrency prices: A comparative analysis from Bitcoin and Ethereum.” *Finance Research Letters* 29 (2019): 222–230.

## BEFORE YOU GO

Research Paper: https://ieeexplore.ieee.org/document/9397004