GithubHelp home page GithubHelp logo

lstm_stock_prediction's People

Contributors

etai83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lstm_stock_prediction's Issues

Forecasting future datapoints?

I know that model.predict in this case needs to have three dimensions, but how can I forecast the future with only "dates" or the x axis?

Splitting the data twice?

Why do you split that data twice? You do it first manually in loaddata() then you do it again when you fit the model using validation_split = 0.1 , you could use validation_data= (x_test, y_test) instead. This appears to skew the results and you lose the important data which is the most recent points.

Increase csv data points

Hi etai83,

Thank you very much for your code, i'm learning neural network coding and this was pretty interesting.

I'm trying to increase the number of data points in the raw csv, with the same format as before but i'm getting an error. The only difference is that the number of rows in the url's output csv goes to 730.

Can you tell me what am I doing wrong?
Error:

Traceback (most recent call last):
  File "/home/lucardi/Downloads/Python/prediction.py", line 47, in <module>
    df['Open'] = df['Open'] / 100
  File "/usr/local/lib/python3.5/dist-packages/pandas/core/ops.py", line 721, in wrapper
    result = wrap_results(safe_na_op(lvalues, rvalues))
  File "/usr/local/lib/python3.5/dist-packages/pandas/core/ops.py", line 692, in safe_na_op
    lambda x: op(x, rvalues))
  File "pandas/_libs/algos_common_helper.pxi", line 1212, in pandas._libs.algos.arrmap_object (pandas/_libs/algos.c:31954)
  File "/usr/local/lib/python3.5/dist-packages/pandas/core/ops.py", line 692, in <lambda>
    lambda x: op(x, rvalues))
TypeError: unsupported operand type(s) for /: 'str' and 'int'

Code:

def get_stock_data(stock_name, normalized=0):
	url="https://www.google.com/finance/historical?cid=12607212&startdate=Jun+27%2C+2014&enddate=Jun+26%2C+2017&num=30&ei=JohRWYGFKMSde-zRjugB&output=csv"
	col_names = ['Date','Open','High','Low','Close','Volume']
	stocks = pd.read_csv(url, header=0, names=col_names)
	df = pd.DataFrame(stocks)
	date_split = df['Date'].str.split('-').str
	df['Year'], df['Month'], df['Day'] = date_split
	df["Volume"] = df["Volume"] / 1000
	df["Close"] = df["Close"] / 1000
	df["High"] = df["High"] / 1000
	df.drop(df.columns[[0,3,5,6, 7,8]], axis=1, inplace=True)
	return df

Flat Line Predictions

First of all, thanks so much for this code. It has been fun for me to try and understand and work with to familiarize myself with these concepts.

I am having an issue with this workbook though. I am always getting a straight line for my predictions in the final graph.

http://imgur.com/wOlqoW5

Is it possible that I am running the wrong version of Keras or one of the other dependencies? if so, do you have any idea what versions you were running?

Any guidance would be greatly appreciated.

Thanks very much.

y_test starts from the beginning of complete dataset

Hi, Thank you for sharing this code. I am have been using this code to learn about machine learning, by trying to predict Bitcoin values. I noticed that the test data (y_test) start from the beginning of the dataset at line. X_train, y_train, X_test, y_test = load_data(df[::-1], window). Any particular reason for that?

about the RMS/RMSE result

hi, the stock data would be different while running this code on different date? and the value of prediction should be same single value strangely? what's more, the train score:2.83 MSE(1.68 RMSE) and test score:1.22 MSE(1.10 RMSE) are not just like 0.08MSE(0,29RMSE) and 0.04MSE(0,20RMSE). Thanks a lot.

[plz explain] understanding problem of how far the prediction is into the future

Hello Community,
I was able to test this program, even I needed to get the CSV from somewhere else.
However I do not realy understand nor I cannot find the the relevant parts within the program which tells me how far each prediction on the graph is ahead of the knowlage it has about the priceline.
I would be very happy if someone could guid me .

THX!!!

A question on load_data

Hi, just reading your codes. It seems like the load_data function is predicting day 1 (in y test) by using day 2 to day 6 (in x test). Just wondering the right method should be predicting day 6 closing price by using day 1 to day 5? Thanks

prediction always 0

Hi,
Iv'e altered your code to support google API instead of yahoo which stopped working
but the prediction seems to always return 0, even the acc prints always 0,
can you please explain why?

Doesn't Work

Using your latest code, the prediction is a straight line.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.