PyTorch Vision for stock chart classification - request for help with models #109
-
@mrdbourke you are a super star! I'm trying to bringing to practice your amazing PyTorch video. ContextI'm writing a PyTorch vision model to understand the success rate of early morning trades on a gap up/down strategy using candlestick chart images. I built a tool that scans for stocks which opened more than 2% higher than the previous day, gap up (or less than -2%, gap down). I then follow those stocks on a 3 minutes chart interval. I want to add an AI layer to help filter most likely successful trades early in the session. I have a set of about 1000 charts. Each chart is tagged with 2 labels [success, failure] based on whether the price reached the target or the stop throughout the day. What am I trying to achieve?My goal is to provide a chart to the AI early in the morning and get a probability of success for a certain pattern. I am playing with models, but frankly I do not know what I am doing :) What I built so far?Here an example of the charts with labels (width 1800px, height 1200px, 3 channels, 2 labels): Here a manual classification tool I built to gather training and tests images. td-training-speed.mp4Which models did I use?I tried the TinyVGG as a starting point and the AlexNet model. Here a Google Colab link with some test code: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Not sure if computer vision is the right approach here. Assuming you are able to gather all the stock data, perhaps it makes sense to look at approaches more suitable to tabular data (which your data essentially is). Right now, Deep learning methods haven't proved significantly better than non-DL methods such as xGBoost. (See this recently published paper). You're making a timeseries prediction, this example notebook might help, as it is very similar to your data, but instead of Energie consumption, your data is stock price. Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hey @fabriziogiordano, Fantastically posed question but I don't recommend using ML for any kind of stock forecasting or trading. See my explanations here: https://dev.mrdbourke.com/tensorflow-deep-learning/10_time_series_forecasting_in_tensorflow/#model-10-why-forecasting-is-bs-the-turkey-problem But essentially, the "free" market is free precisely because it is unpredictable. You will likely find it quite hard to beat a model that just tosses a coin every day saying whether the market is up or down (which is what you're seeing with the results of ~55% on the test set). And even if it does get it right more than 50%, much of it will be luck. For further reading, I'd suggest Nassim Taleb's books, I tweeted about this recently: https://twitter.com/mrdbourke/status/1564378048698667009?s=20&t=HuO0hSaoigf8h_2wS1Yrug Happy to expand/write more on this if you like. |
Beta Was this translation helpful? Give feedback.
-
Thank you @mrdbourke and @aronvandepol ! |
Beta Was this translation helpful? Give feedback.
Hey @fabriziogiordano,
Fantastically posed question but I don't recommend using ML for any kind of stock forecasting or trading.
See my explanations here: https://dev.mrdbourke.com/tensorflow-deep-learning/10_time_series_forecasting_in_tensorflow/#model-10-why-forecasting-is-bs-the-turkey-problem
But essentially, the "free" market is free precisely because it is unpredictable.
You will likely find it quite hard to beat a model that just tosses a coin every day saying whether the market is up or down (which is what you're seeing with the results of ~55% on the test set).
And even if it does get it right more than 50%, much of it will be luck.
For further reading, I'd suggest Nassim Taleb's…