LSTM Neural Network for Ethereum Price Prediction

Hang Xu
data-surge
Published in
3 min readNov 1, 2021

Premise

NFTs or Non-fungible tokens are currently all the craze, they are mainly traded using the cryptocurrency Ethereum(ETH). So why not try to use Machine Learning to predict its trends? Let’s do precisely that!

Acquiring the Dataset

There is an abundance of places across the internet that you can scour to find the necessary historical data to feed your ML model. The one that I landed on was Crypto Compare, their documentation was extensive and their UI allowed me to very quickly and accurately pull up data regarding Ethereum with just a couple of parameter adjustments.

Setting up the environment

Once all the libraries and dependencies have been installed and loaded, you can make the create the code for the api call to retrieve the dataset you are going to be running your model on.

Split the dataset into two, one will be used to train the model and the other will be used to test the predictions made to measure the accuracy. We will be splitting the data set 80/20(train/test) and then graphing that historical data using matplotlib.

Keras

Now that we have the data sorted, we can build the model to train the datasets on and Keras has provided us a high level abstraction of the underlying building blocks needed to formulate ML models.

When the model performs the fitting of the training dataset, there will be loss as defined by the Dropout, this is put in place so that the results don’t overfit and cause the model to be unable to generalize the information

Plotting the Predictions vs the Actual

Now that the training of the model is completed, we can run the model on the test dataset to see if we can produce a prediction with any sort of accuracy.

There will always be prediction errors and a perfect 100% accuracy is impossible to achieve due to things such as

  • Noise in the data
  • The nature of underlying algorithms containing randomness and uncertainty
  • Incompleteness of data sample

Once we have trained and made the predictions using our model, keras also gives us methods to save and load our models for future use.

Conclusion

The market and Ethereum in our day and age is a fascinating topic that has caught many people off guard. During the pursuit of this project, I’ve gained greater insights on the abstractions that modern day libraries provide for us and how to implement a version of that to achieve a goal that was otherwise completely unknown to me prior to starting. Machine Learning is a topic that I’ve just begun to scratch at and I’m excited to further pursue and learn its intricacies. Keras is an extremely extensive library packed with great features and is easy to follow along with. Their docs can be found here.

If you would like us to evaluate and review your ML/AI needs or help you implement a ML model, please email us at info@datasurge.com or complete the form on our contact us page

--

--