Bitcoin Price Prediction in Machine Learning

 Introduction

In this tutorial, we are going to start our new project session on Bitcoin price prediction in machine learning using the linear regression model. This model predicts the price of the Bitcoin on the market basis.


After implement the project, you will learn like :

  1. How to load data from the GitHub
  2. how to deal with the correlated features
  3. How to visualize the data
  4. How to deal with null values
  5. Learn how to apply feature scaling
  6. Error  evaluation

Let's start :-

Firstly the basic step is to load all the required libraries and we load the warnings library which is used to deal with the warnings which are generated at the runtime of code execution.

Then Import the data set from GitHub using the database URL and Show the five rows of Bitcoin data set. the data set contains 24 features like btc_market_price, btc_total_bitcoin,  btc_trade_volume, btc_market_cap, btc_output_volume etc.


Then perform the  exploratory data analysis, firstly describe the data to see the minimum,  maximum, standard deviation, count values etc.


Then check that there are Null values present or not in our features of the data set. If Null values are present then we have to deal with the Null values of features.


Then see the information of the data set which shows that data type, Null values of every feature of our data set.


Then try to deal with the correlation, Correlation explains how one or more features are related to each other. So, in this we try to see how all the features are correlated with our target feature. So, firstly we see the correlation of all the features using the corr() command.


Now we visualise the correlation of all the features using the corr() command and heatmap() function of seaborn library which takes some parameters. So, we can see the correlation in the picture below which shows correlation with all features in an attractive manner.


Now let’s implement a function with name correlation() which takes two parameters, firstly the data and the second one is a threshold value. This function returns all the features which are correlated with our target  feature above the threshold value.


When we call this function correlation() it takes data and threshold value and passes a data and 0.81 threshold value, then this function returns all the features which are correlated with the target features above 0.81 threshold value. And display the returned features. You can see in the image below.



Now see the correlation of target feature or column with btc_market_cap in the picture below. So, btc_market_price is highly correlated with btc_market_cap.


Now keep all the features' data which are correlated with our target features in the new data frame and display the new data frame and show the size of the new data frame, as you can see in the picture below.


Now deal with the Null values, first we check which features contain the Null values. So, btc_trade_volume and btc_cost_per_transaction contains null values. Then fill the Null values with the mean value of a particular feature. Then again check that there are Null values or not.


Now separate the independent and dependent features aur holdout cross validation, then split the data into the training and testing using the train_test_split function which takes some parameter and returns four parameters, and then checks the shape of all the four parameters, as you can see in the picture below.


Then apply the feature scaling which scales the data in a particular range or we can say that apply a normalisation technique to normalise the data.

Then define the linear regression model with default parameters then train a model with training data (X_train and y_train).

Then test tne model using the  test data, as you can see in the picture below.



Then evaluate the model that it is performing. Check the mean squared error, root mean squared error and mean absolute error.


Source code 

  1. Go to my GitHub account and download or fork repo : BitCoin Price Prediction
  2. Then open file using jupyter notebook.

Video Tutorial 


Thank You !!!!!!!!!!!

2 Comments

If you have any doubts, Please let me know

  1. Thanks for sharing such a helpful post! This is a very informative & great Post. I got too much information about crypto heatmap live & updates from this post. Keep Posting!

    ReplyDelete
    Replies
    1. Thank You 😊... I'll upload new and interesting post soon

      Delete
Post a Comment
Previous Post Next Post