Time Series Forecasting Using Machine Learning| Python
Vložit
- čas přidán 26. 04. 2021
- In this video i show how you can use machine learning(ML) technqiues to make time series predictions and forecasting.
You can convert time series data into supervised learning problem by shifting the dataset. In this video I use linear regression and random forest machine learning models to make time series forecasting in python.
Recommended Books to get better at Time Series Analysis and Python:
1)Practical Time Series Analysis: amzn.to/31lsLhq
2)Time Series with Python: amzn.to/2Ez073m
3)Hands-On Time Series Analysis with R: amzn.to/3aUxuKq
My 2nd CZcams Channel: / @nachitalks
Github Source Code: github.com/nachi-hebbar/Time-... - Věda a technologie
Great job with the videos. I've learned so much here!!
Great video, thanks. However, what about the future forecasts? Like for x_test we have fed the lag values of the dependent variable, but those aren't available with us. Suppose we have the data till feb 2022, and want to forecast for next 3 months, we don't have the x_test ie lag values available for next 3 months right? I think this is where rolling time window or something like walk forward validation is needed
Hey man, great pointers on how to convert regular csv into time series data. However, I don't think you should really call a linear model machine learning. If you had a massive dataset it would be way to time consuming to make a new column for each month back.
Brother,
only training and testing done here, what about the future forecast? As we are interested in future predictions.
Up
Hi, how can i perform out of sample forecasts using your model?
Hi Nachiketa. Awesome video but unlike the one of ARIMA video of yours, you did not predict future 10 or so days? Have you uploaded any such videos where you have predicted values? I am looking for some code which will help me predict via linear regression or random forest.
hey thanks for video , how I can get my linear model accuracy?
do we need to have regular intervals of timeseries for prediction?
what if we have to predict next days sale, using previous_1 and previous_2 days ,and we dont have previous_1 day value for some rows?
if we need regular intervals of timeseries for prediction, how to get previous_1 in this case?
great video, brother can you please make a video in prediction of values with respect to several past data.
thank you for getting me through university.
You should use a rolling/expanding time window for train/test split.
hi bro, can u give me link video or something that use time window? i want learn it
cool! thank you
Hello nachiket what about future prediction? how can i know next month prediction?
Are u have XGboost code for time series?
hi mr. nachi. if i have data that use "year", what do I change to the code?
Like you do for ARIMA model, should you make the time series data stationary even when you use machine learning models?
Yes. Both models would have performed better had he addressed the seasonality and trend components clearly present in the data.
This is a great video. But how do you predict the value of sales for the next year?
Nice explaination.
Can you try multivariate using prophet model
hey nachiket, really very well experienced. Is it possible to forecast sales of multiple car types in one model?. or do we have to create separate models for each car type sales.
After transform your time serie in a machine learning problem, you can use classification models as well
How come we are not checking the stationarity before starting with the model? Or forecasting using machine learning somehow automatically takes care of that? I'm kinda confused
Nice work bro..please answer this question.I understood the whole process of taking the previous 3 values for every datapoint as input features.But shouldnt a Linear regression model give a single straight line output.I was asked this in interview and couldnt answer properly.Kindly give your answer on this.
Linear regression means that your model assumes a liniar relationship between inputs and output, not that the output is a straight line.
If you take the past 3 values as inputs (as shown in this video), and assume a model such as yt = 0.5*yt-1 + 0.3*yt-2 + 0.2*yt-3, your output will increase as past 3 months sales trend up and decrease when past 3 months sales trend down.
As the dataset shows a strong seasonal behavior, such a linear model wouldn't be the best choice. Check out Nachiketa's videos on stationarity.
how to find random forest regressor fitted values for training accuracy measures
also how to predict the next one month values? using inferencing? or next 10 month values using inferencing?
it can connect to mysql ?
Why not do the autocorrelation first to determine the significant lag? Since you put the lag shift directly, your basic reasoning for the model fit becomes weak.
Hey Nachiketa, here you have taken up to 3 lag values(sales_3months back).
pmdarima library automatically determines p. In my other dataset, I got p=1, but upon converting the timeseries to ML, upto t-7 gave better results.
Upto what t-n should we take when converting to ML problem?
if you are using t-7 thats fine too. pmdarima tries to minimize the complexity of the model thats why you get different results. pmdarima penalizes the model for considering too many lags, while ml model is only concerned with accuracy. You can choose any of them, based on what your priority is.
My friend wanted to do B Tech in AI/ML after diploma, can you suggest the carrer path for the same ?
Hey Nachiket. Shouldn't the final_x contain value in the order sales_3monthsback, sales_2monthsback, sales_1monthback?
If not, Does the order not matter ?
Hey, technically you are right and we should keep the order as you mentioned. However it does not really matter, and it wont fact the accuracy of forecasts.
While making predictions however, you just have to keep the same order in input as was given in the final_x
pretty cool
Bro where did you download the data
How to forecast the future using the models in the video once training, validation, and testing has been done using the dataset?
even I am looking for the same.. were u able to find a way?
@@hesamulhaque2197, I was working on a framework that used the random forest algorithm. After extensive research, I concluded that one could simultaneously forecast ONE horizon value (let's call it y_hat_1). To predict a second horizon step, i.e., y_hat_2, one has to add y_hat_1 back to the dataset as y_1 (i.e., the actual value) and use it as a feature to forecast y_hat_2. Similarly, to predict y_hat_3, one must add y_hat_2 (as y_2) and y_hat_1 (as y_1) back to the features data set.
If the scenario described above is for daily time series data, you can continue to generate forecasts for 'n' days where 'n' = 1,2,3,...., N. If you have to make a forecast every week, at the end of week one, you will have the actual values available for the past week. Consider those actual values (in place of the y_hat values we added earlier to make a forecast), and retrain the model to create new forecasts (following the steps detailed earlier).
Consider ARIMA, SARIMAX, and HW models as well. In my case, I found them equally good. Generating a forecast (for the horizon) is way easier. One must mention the start and stop times in the predict command to generate a forecast.
Good Luck.
Looking for the same here, did you find this solution ?
Can I get future stock price using ml? How accurately will be it's output
totally depending on your model tuning and feature engineering!
where is the prediction, what if i want to now just next future value
what should i do then?
I'm enchanted by this content. I read a book with similar content, and I was truly enchanted. "The Art of Meaningful Relationships in the 21st Century" by Leo Flint
Hey, I tried the ARIMA model on a time series recently and I believe I'm getting more error than desired, do you think running a Linear Regression like this might help me reduce the error?
It does not matter what model you use, if you are getting error, you may have written wrong code. And, Arima parameters should not be chosen blindly.
how to predict next 10days future dataa
Could you please send the base paper of project
Shouldnt we do cross-validation also?
you can use cross-validation, but its not necessary
Why shifting +1, +2, +3, i m not able to understand that part
Dus tarah key indicated banao mix average score batao
you did not explain how to do the forecast on the entire dataset
Heiiin you're calling an classification model on an quatitative target ? ! you didint even binarize your features !
Man, atleast have the courtesy to reply when clearly you don't have many comments to reply or anything.
Forget him,, all you need is icdst Ai predict.