Python Programming Tutorials

Linear Regression following Sentdex's tutorials

Hello. I am trying to do some machine learning on some bitcoin data, specifically linear regression. The full code is here, but in order to plot it on a graph, I want to use the values of y (which is the values of x in 14.5 days time, so price in 14.5 days time) where I use the old actual values of y followed by the new values of y which are the predictions. In order to do this I need to find the values of X which have values for y (the predictions) and the values for x which already have the price in 14.5 days time. I performed a shift on the data, meaning some Xs have values for Y in 14.5 days time and some don't.
Why 14.5 days? As the data set is 1450 days long and I did a 0.01 negative shift. Hopefully I communicated what I was trying to say alright.
import pandas as pd import math import numpy as np from sklearn import preprocessing, svm from sklearn.model_selection import cross_validate from sklearn.model_selection import train_test_split from sklearn.linear_model import LinearRegression from statistics import mean import matplotlib.pyplot as plt from matplotlib import style df = pd.read_csv("coinbaseUSD_1-min_data_2014-12-01_to_2019-01-09.csv") df['date'] = pd.to_datetime(df['Timestamp'],unit='s') print("calculating...") forecast_col = 'Weighted_Price' forecast_out = int(math.ceil(0.01*len(df))) #forecast_out = 20998 = 20998 minutes = 14.5 days df['label'] = df[forecast_col].shift(-forecast_out) df = df[['date', 'Weighted_Price', 'label']] df.dropna(inplace=True) X = np.array(df['Weighted_Price'], dtype = np.float64) y = np.array(df['label'], dtype=np.float64) X_lately = X[-forecast_out:] X = X[:-forecast_out:] def best_fit_line(X, y): m = (((mean(X) * mean(y)) - mean(X*y)) / ((mean(X) * mean(X)) - mean(X*X))) c = mean(y) - (m * (mean(X))) return m, c m, c = best_fit_line(X, y) print(m, c) regression_line = [(m*values) for values in X] plt.scatter(X, y) plt.plot(X, regression_line)

So what have I tried? The offender is this line here:
X_lately = X[-forecast_out:] X = X[:-forecast_out:]
That is what sentdex did in the video series, but I get the error: ValueError: operands could not be broadcast together with shapes (1871868,) (1892866,)
This doesn't work with:
m = (((mean(X) * mean(y)) - mean(X*y)) / ((mean(X) * mean(X)) - mean(X*X)))
due to this making the X and Ys different lengths? I'm not sure.
What am I doing wrong?
submitted by EnvironmentalPause5 to learnpython [link] [comments]

Time Traveller's Prediction for Bitcoin Price 2019 Bitcoin Trading - Visualizing our data in Matplotlib Bitcoin: Is it just a speculative Bubble? Bitcoin Protocol - Combining and Splitting Value Bitcoin Trading - Streaming Live Bitcoin prices through Exchange API

If you don't pass a parameter, 5 is the default value. We mosly will use .head() to just get a quick glimpse of our data to make sure we're on the right track. Looks great to me! In case you do not know: Open - When the stock market opens in the morning for trading, what was the price of one share? High - over the course of the trading day, what was the highest value for that day? Low - over ... Bitcoin Protocol Paper Playlist: All Bitcoin Videos Playlist: http ... Bitcoin; London Stocks (LSE) Australian Securities (ASX) 7 Days. 30 Days . 6 months. 1 Year. All-Time. Search Companies. Overlay Sentiment. Volume time frame and overall sentiment time frame is determined by the current time frame of the company you are currently viewing. Change the graph's time frame to change this table's. Symbol Instrument Name 7D Volume of Mentions 7D Overall Sentiment ... Python Programming tutorials from beginner to advanced on a massive variety of topics. All video and text tutorials are free. Bitcoin had previously failed to close above $13,000 every day since Jan. 15, 2018.

[index] [11754] [25603] [14277] [46026] [20280] [12790] [5117] [29043] [38095] [21760]

Time Traveller's Prediction for Bitcoin Price 2019

As Bitcoin, and other cryptocurrencies gain popularity, more and more people are curious about becoming a part of it. Many people start out curious about mining Bitcoins first, but then begin to ... This video is unavailable. Watch Queue Queue Bitcoin Protocol Paper Playlist: All Bitcoin Videos Playlist... Plotting live bitcoin price data - Tkinter GUI development series p. 9 - Duration: 17 minutes. sentdex . 5 years ago; 31,044 views; In this Python 3 with Tkinter programming tutorial, we cover ... Back in 2013, an anonymous figure posted on the r/Bitcoin subreddit claiming to be a time traveller from the year 2025. He made a series of predictions for the price of Bitcoin in future years ...