David Andrés 🤖📈🐍
David Andrés 🤖📈🐍

@daansan_ml

9 Tweets 5 reads Feb 12, 2024
You can forecast Time Series data using a Machine Learning algorithm like XGBoost or Random Forest.
However, you need to reframe your problem as a Supervised Learning one.
Learn here how to do it 🧵 👇
There are many ways of converting your Time Series data into a Supervised Learning problem.
👉 We will introduce the simplest one.
Basically, a window of a specific size (let's say of size 3) will be rolling down your dataset.
▶️ The first 3 observations will be the features or 'X' of your dataset:
🔹 Feature 1: the observation at t-3
🔹 Feature 2: the observation at t-2
🔹 Feature 3: the observation at t-1
▶️ The next observation will be your target or 'y':
🔹 Target: the observation at t
In addition to this, you could also add more features, for example:
🔹day of the week
🔹month
🔹observation a month ago
🔹...
You could also engineer or add some more features:
🔹mean value of the last 2 weeks
🔹average value on the same day during the last 3 years
🔹temperature on the previous day
🔹...
There are endless combinations. Finding the right features is part of your job!
To help you start with this I will give you a snippet of how to do the rolling window method in Python 👇
⚠️Bear in mind that Forex and stock market in general is most of the time unpredictable.
This is just an example that you can extrapolate to other fields and data.
You should also join the newsletter I share with Levi, DSBoost🚀
Every week we share:
🔹Interviews
🔹Podcast notes
🔹Learning resources
🔹Interesting collections of content
Subscribe for free👇👇
dsboost.dev

Loading suggestions...