Skip to content

Added lstm stock prediction #1777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed

Added lstm stock prediction #1777

wants to merge 4 commits into from

Conversation

Tejaswgupta
Copy link

Describe your change:

Pr against issue #1770

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This submission is quite complected containing numerous code files and data files, etc. It feels quite different that the other algorithms in this repo. It feels like an entire subsystem rather that an algorithm. It has no type hint, no doctest, no black formatting, etc. Should it be modified to fit into this repo or in a repo somewhere else?

timer.start()

for layer in configs['model']['layers']:
neurons = layer['neurons'] if 'neurons' in layer else None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use dict.get()... https://docs.python.org/3/library/stdtypes.html#dict.get

neurons = layer.get('neurons') # Repeat below...

normalise=configs['data']['normalise']
)

predictions = model.predict_sequences_multiple(x_test, configs['data']['sequence_length'], configs['data']['sequence_length'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format code with psf/black to limit lines to 88 characters max.

class DataLoader():
"""A class for loading and transforming data for the lstm model"""

def __init__(self, filename, split, cols):
Copy link
Member

@cclauss cclauss Feb 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints and doctests please.

data_windows.append(self.data_test[i:i+seq_len])

data_windows = np.array(data_windows).astype(float)
data_windows = self.normalise_windows(data_windows, single_window=False) if normalise else data_windows
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is too long for a ternary if... Just do a normal if and wrap lines to 88 char max.

@Tejaswgupta
Copy link
Author

So should I fix or it doesn't belong here?

@onlinejudge95
Copy link
Collaborator

@Tejaswgupta let's do a spike. How about you abstract away all the configurations out and only submit the algorithm. That being said also make sure to document your configuration if required in module level docstring. I guess then we will have enough clarity to decide on the same.

PS- In any case it would be good if you address the changes.

@github-actions
Copy link

Stale pull request message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants