Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded Lstm example for stock predection #1908
Conversation
| from keras.models import Sequential | ||
| from keras.layers import LSTM,Dense | ||
|
|
||
| def clean_data(data_file): |
This comment has been minimized.
This comment has been minimized.
cclauss
Apr 26, 2020
•
Member
No type hints, no doctests. See CONTRIBUTING.md.
Is this flexible to clean multiple datasets or is it hardwared to this particular dataset? If flexible, what other dataset could the reader consider using?
|
|
||
| def clean_data(data_file): | ||
| ''' | ||
| This function will read and clean data |
This comment has been minimized.
This comment has been minimized.
| output: Data which will be useful for training | ||
| ''' | ||
| df = pd.read_csv(data_file, header=None) | ||
| print(df.head()) |
This comment has been minimized.
This comment has been minimized.
| len_data = df.shape[:1][0] | ||
| actual_data = df.iloc[:,1:2] | ||
| actual_data = actual_data.values.reshape(len_data,1) | ||
| scl = MinMaxScaler() |
This comment has been minimized.
This comment has been minimized.
cclauss
Apr 26, 2020
Member
scl --> min_max_scaler (don't make your reader guess) or just do MinMaxScaler().fit_transform(actual_data) if it is a one-time use.
| print(train_data,test_data) | ||
| train_x,train_y=[],[] | ||
| test_x,test_y=[],[] | ||
| for i in range(0,len(train_data) - forward_days - look_back + 1,1): |
This comment has been minimized.
This comment has been minimized.
cclauss
Apr 26, 2020
Member
Why start with zero and end with one. These are not needed and only distract your reader. Same a few lines below.
| print(x_train.shape) | ||
| print(x_test.shape) | ||
| print(y_train.shape) | ||
| print(y_test.shape) |
This comment has been minimized.
This comment has been minimized.
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| x_train,y_train,x_test,y_test = clean_data('google_data.csv') |
This comment has been minimized.
This comment has been minimized.
cclauss
Apr 26, 2020
•
Member
Where does google_data.csv come from and under what license is it published?
Strong preference would be that this data is downloaded in the __main__ code block rather than being stored in this repo.
This comment has been minimized.
This comment has been minimized.
| @@ -0,0 +1,66 @@ | |||
| import pandas as pd | |||
This comment has been minimized.
This comment has been minimized.
cclauss
Apr 26, 2020
Member
It would be helpful if this file defined what LSTM is. Or at least pointed to an article like https://en.wikipedia.org/wiki/Long_short-term_memory to so than readers do not need to guess.
The only function in this submission is clean_data() so is this the submission of an example (as the PR title says) of how to use Python packages or is there an algorithm here? See CONTRIBUTING.md's What is an algorithm?
This comment has been minimized.
This comment has been minimized.
jeffin07
Apr 27, 2020
Author
Contributor
This is an example of LSTM stock prediction using Keras,Which is a deep-learning library
|
Done Changes after the review |
|
Hi there, I just wanted to let you know why the build is failing. The build is failing due to an This is what CONTRIBUTING.md says:
Assuming your module requires the latest version of keras you will need to add |
|
I think the problem is that keras requires tensorflow Update: this was fixed in TensorFlow 2.2.0 which was released 11 hours ago. |
|
Thanks for your contribution. |
jeffin07 commentedApr 26, 2020
Describe your change:
PR for the issue #1770
I have created a small LSTM network for stock prediction.The data used are also included
Checklist:
Fixes: #{$ISSUE_NO}.