JoeKurokawa

Learning ML Part V: Creating a model using Scikit Learn

This week we will develop our model further with regression. The goal of my project is to see if there is a reliable model that can be produced from bitcoin or any of the Altcoins. Mainly Ethereum, Ripple, and Litecoin.

 

We will first leave off with where we left on in Part IV After you have imported data through numpy, we will process the training data.

After importing data through csv, we will take the first row and convert it to a datetime object. from the datetime object, we will convert it to a unix timestamp and put in an array dates. For prices we will take the closing value and put them in an array prices.

We will use linear regression first to try it out. You can see a good example here: Linear Reg. Example

The above image, you can see that a linear regression does not quite fit the training data. Lets try a polynomial regression:

The plot of the polynomial graph is above. The code is as follows

 

Here we enumerate over degrees 3 to 6 and plot the results. We see that the plot degree 6 has the closest to the scatter plot so we will use that. The coefficients are : [-5.40037231e+06, 5.23410271e-01, -1.44786669e-09, 1.51985693e-18, -7.11067134e-28, 1.24872305e-37]

remember that polynomial regressions are of the form:

So the equation is of the form:

To get the MSE for the degree 6 plot we call:

mean_squared_error(y_train, y_pred)

and we get 1095563.04 which is significantly high number. So it does not guarantee the accuracy of our model. Next week we will see if we can get our model closer and see next week if any other digital currencies can be modeled using linear or polynomial regression.

You Just Finished your First Model in Sci-Kit Learn!

Leave a Comment