Coder Social home page Coder Social logo

Comments (4)

DidierRLopes avatar DidierRLopes commented on April 28, 2024 1

Hey @avocardio , these issues comes from my other module TimeSeriesCrossValidation. And this means that the data you are using to train these models (or "fit" in case of the regressions) is not enough given your number of inputs and number of outputs.

For instance, imagine that you want to predict the share price of Monday using the stock prices of this last week (5 days). You will define the number of outputs to be 1 because you only want to predict 1 share price, and the number of inputs of 5 because you want to use the data of the 5 previous consecutive days.

If when you load the model, you select a starting date -s that starts last week, you won't be able to train because you are using the data that you would be effectively using for prediction. Meaning that you probably need to set that starting date -s for a value more in the past so that you can use that data for training/fitting your model.

Let me know if this makes sense.

TL;DR: Set the starting date flag -s with a value further in the past

from openbbterminal.

avocardio avatar avocardio commented on April 28, 2024

Makes perfect sense @DidierRLopes , thank you so much. What would be a good time frame for the preds in your opinion? The errors above came from a timeframe starting 2021-01-01.

from openbbterminal.

DidierRLopes avatar DidierRLopes commented on April 28, 2024

No worries, always happy to help.

Yea that makes sense, by default the algorithm has -i 40 which expects 40 data points. If you are using daily data, this corresponds to 2 months.

There isn't a "right" time frame to use, there are several things that you need to do in order to have one of the Neural Networks optimized for your stock price. Here are some things to look at when doing this:

  • First of all I'd say for you to look at the entire historical data of a stock and try to understand since when up till now the stock has behaved rather similarly. I.e. if you look into the historical data of 20 years ago, probably the stock price didn't move much. So I'd avoid training a model with this.
  • You have to set the training days that you want. Note that that if -i is 40 you are using 40/5= 8 weeks of data = 2 months.
  • You have to set the prediction days, here I'd recommend to set it to 1. As predicting further down in the future is much more complicated, because you have a much larger range to "deviate" from the last valid stock price, if it makes sense
  • You have the model that you want to chose. The models defined per default don't have any guarantees, I just made sure they ran fine, tested a few different ones, and left it like that. Each user must tune it's NN for the stock they want. When I come to implementing #5 this will be great as it will allow you to "validate" your model. You're gonna be able to test on this past data how your model would work out. And I already have a great idea on how to make this work smoothly, can't wait to implement this.
  • This validation is important because it allows you to set not only your model, but number of training epochs, if data is pre-processed, the optimizer in use, the type of loss function.

Seriously, there's just so much to it. That's the beauty of it.

PS: One thing you can do if you want to not "lose" too much time, is research "successful" papers on stock prediction that disclose how they implemented certain NN (most likely LSTM since this one has a "notion" of time) and just implement it, as the code is written in a way that is really easy to configure a neural network to your own taste!

from openbbterminal.

avocardio avatar avocardio commented on April 28, 2024

Thanks for the nice explanation, I really appreciate what you're doing with this !

from openbbterminal.

Related Issues (20)

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.