llSourcell / predicting_stock_prices

This is the coding challenge for "Predicting Stock Prices" by @Sirajology on Youtube
297 stars 196 forks source link

Get no output. #6

Closed Steviey closed 5 years ago

Steviey commented 7 years ago

I got no output, no error message running demo.py on Win7/Anaconda even while trying alternative backends. Any suggestions? I'm so disappointed now...deeply depressed.

pick1 commented 7 years ago

Same... running jupyter and endless hang at - predict_price(dates, prices, 29)

enderg commented 6 years ago

I also have an endless hang at predict_price

bsirmacek commented 5 years ago

Same :-( endless waiting and no result.

bsirmacek commented 5 years ago

Okay I resolved the issue. It is working for me now.

It looks like libraries changed their syntaxes a lot since then.

Here how I import things:

import csv import numpy as np from sklearn.svm import SVR import matplotlib.pyplot as plt plt.switch_backend('TkAgg')

Another change:

dates = np.reshape(dates,(len(dates), 1)) # converting to matrix of n X 1

dates = np.reshape(dates,(-1, 1))

Also removed the color and label from plot (probably needs to be defined differently, the old way of color and label definition is not working.)

plt.plot(dates,svr_poly.predict(dates))