Bitcoin Price Prediction using Machine Learning

Published on . Written by

Bitcoin Price Prediction using Machine Learning

As we all know, Machine Learning is ruling the world nowadays. You name it to predict, Machine Learning is there for your predictions. Whether it is Breast Cancer predictions or online grocery recommendation Machine Learning is everywhere and is used by many small to big-sized companies. However, the predictions are not 100% accurate. Depending on which algorithms you have applied, the accuracy varies. Bitcoin Price prediction using Machine Learning can be 67-70% accurate.


Skyfi Labs Projects
Objective:

The objective of this machine learning project is to predict the price of Bitcoins. After the popularity of Bitcoins, it is classified as assets.

Read more..

SLNOTE
Concepts Used:

 

  • Beginner level knowledge of Python 3 or above
  • Basic Algorithms of Machine Learning
 

Hardware and Software Specifications:

 

  • Your preferred Operating System. (For an instance Windows, Linux or Mac)
  • A desktop or laptop (whatever you prefer for ML computations)
  • Your favourite text editor (like Notepad++ or Notepad, etc.)
  • Python 3 or above installed in your desktop or laptop.
 


SLLATEST
Implementations:

 

  • Install Numpy, Keras. You can also use TensorFlow instead of Keras.
  • Download Jupyter Notebook.
 

How To Install Jupyter Notebook?

Using Anaconda:

 

If you want to download Jupyter using Anaconda, You have to install python and Jupyter using Anaconda Distribution. Head to Anaconda 2019 Windows Installer and you can find download links there. This installation includes Jupyter Notebook.

Using PIP:

 

  1. If you don’t want to use Anaconda, not a problem. You can directly download Jupyter Notebook using PIP command. At first upgrade your PIP command using Python -m pip install –upgrade pip
  2. Open command prompt and type python -m pip install jupyter
  3. It will take some time to collect data and launch Jupyter. Once the installation is finished, type Jupyter Notebook to launch.
Collect Data Set:

To train the model to predict the Bitcoin prices we need to have training data. Collect the data. The data might have some gaps. 

Read the CSV files. The code is given below.

data = read.csv(“../input/data.csv”)

Remove the rows and columns that you will not use or which are not required.

Now, split the dataset into two parts. One becomes a training data set and another is test data set. Here we have taken 80% of the data set for training the model and the rest of the 20% are for test set.

   n_train_rows = int(dataset.shape[0]*.8)-1

train = dataset.iloc[:n_train_rows, :]

test = dataset.iloc[n_train_rows:, :]

We are using LSTM algorithm here, so we need to organize our data in blocks. Our data is organized in 1 minute intervals. So we will be using 50 blocks to predict.

Now prepare the training data. 

x_train = []

y_train = []

for i in range(steps, training_set_scaled.shape[0]-steps):

     x_train.append(training_set_scaled[i-steps:i, :])

     y_train.append(training_set_scaled[i, :])

x_train, y_train = np.array(x_train), np.array(y_train)

print(x_train.shape)

  1. Create a variable named prediction_days. This will be an array. Set this equal to the last 30 days of the original data.
  2. Following the above code, prepare test data. 
  3. Now plot the graph of test data and training data.
  4. Now test the model accuracy. 
  5.  Print the predicted values and actual values. Do this for the remaining next 30 days. 
Conclusion

That is it. You have successfully predicted the price of Bitcoin. However, using this algorithm will give you a 70% accurate prediction.


SLDYK
Kit required to develop Bitcoin Price Prediction using Machine Learning:
Technologies you will learn by working on Bitcoin Price Prediction using Machine Learning:


Any Questions?


Subscribe for more project ideas