Time Series Forecasting Using Machine Learning| Python

Sdílet
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

Komentáře • 57

  • @raheempaxton7082
    @raheempaxton7082 Před rokem +1

    Great job with the videos. I've learned so much here!!

  • @chaitrabellur8743
    @chaitrabellur8743 Před 2 lety +11

    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

  • @jamesbailey3061
    @jamesbailey3061 Před 2 lety +2

    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.

  • @shubhamnehete8020
    @shubhamnehete8020 Před 3 lety +12

    Brother,
    only training and testing done here, what about the future forecast? As we are interested in future predictions.

  • @user-wj5ve7sr5d
    @user-wj5ve7sr5d Před rokem +1

    Hi, how can i perform out of sample forecasts using your model?

  • @hesamulhaque2197
    @hesamulhaque2197 Před rokem

    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.

  • @oktayvav
    @oktayvav Před rokem

    hey thanks for video , how I can get my linear model accuracy?

  • @rohandevaki4349
    @rohandevaki4349 Před rokem

    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?

  • @abhinobdutta522
    @abhinobdutta522 Před rokem

    great video, brother can you please make a video in prediction of values with respect to several past data.

  • @LauraPeculiar
    @LauraPeculiar Před 9 měsíci

    thank you for getting me through university.

  • @user-jc9nv6lj9u
    @user-jc9nv6lj9u Před 3 lety +4

    You should use a rolling/expanding time window for train/test split.

    • @naufalakhmadkamal4170
      @naufalakhmadkamal4170 Před 6 měsíci

      hi bro, can u give me link video or something that use time window? i want learn it

  • @a_6892
    @a_6892 Před 2 lety

    cool! thank you

  • @kshitijrandive888
    @kshitijrandive888 Před rokem +1

    Hello nachiket what about future prediction? how can i know next month prediction?

  • @mr.bilalabdualgalil4559

    Are u have XGboost code for time series?

  • @user-tv1ir5fc3x
    @user-tv1ir5fc3x Před 6 měsíci

    hi mr. nachi. if i have data that use "year", what do I change to the code?

  • @sehyunko6340
    @sehyunko6340 Před rokem +2

    Like you do for ARIMA model, should you make the time series data stationary even when you use machine learning models?

    • @matthewwithrow8715
      @matthewwithrow8715 Před 9 měsíci

      Yes. Both models would have performed better had he addressed the seasonality and trend components clearly present in the data.

  • @user-iv9zu4oh8i
    @user-iv9zu4oh8i Před 19 dny

    This is a great video. But how do you predict the value of sales for the next year?

  • @asura2086
    @asura2086 Před 11 dny

    Nice explaination.
    Can you try multivariate using prophet model

  • @rupsrpatil
    @rupsrpatil Před 3 lety +1

    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.

    • @jg5874
      @jg5874 Před 2 lety

      After transform your time serie in a machine learning problem, you can use classification models as well

  • @HaiderAli-pp9go
    @HaiderAli-pp9go Před rokem

    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

  • @divyanshuchaudhari5416
    @divyanshuchaudhari5416 Před 3 lety +3

    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.

    • @Then00tz
      @Then00tz Před 2 lety

      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.

  • @suniljhade7403
    @suniljhade7403 Před rokem

    how to find random forest regressor fitted values for training accuracy measures

  • @rohandevaki4349
    @rohandevaki4349 Před rokem

    also how to predict the next one month values? using inferencing? or next 10 month values using inferencing?

  • @wasss3745
    @wasss3745 Před 2 lety

    it can connect to mysql ?

  • @concretemathematics8146
    @concretemathematics8146 Před rokem +1

    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.

  • @saswatarautray9040
    @saswatarautray9040 Před 3 lety

    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?

    • @NachiketaHebbar
      @NachiketaHebbar  Před 3 lety

      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.

  • @bhambhomoto4457
    @bhambhomoto4457 Před 8 měsíci

    My friend wanted to do B Tech in AI/ML after diploma, can you suggest the carrer path for the same ?

  • @nidhibartakke867
    @nidhibartakke867 Před 3 lety

    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 ?

    • @NachiketaHebbar
      @NachiketaHebbar  Před 3 lety +1

      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

  • @anshheta1411
    @anshheta1411 Před rokem

    pretty cool

  • @pulavarthidhanush315
    @pulavarthidhanush315 Před rokem

    Bro where did you download the data

  • @Learner_123
    @Learner_123 Před rokem +1

    How to forecast the future using the models in the video once training, validation, and testing has been done using the dataset?

    • @hesamulhaque2197
      @hesamulhaque2197 Před rokem

      even I am looking for the same.. were u able to find a way?

    • @Learner_123
      @Learner_123 Před rokem

      @@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.

    • @aehtajazahmed9481
      @aehtajazahmed9481 Před rokem

      Looking for the same here, did you find this solution ?

  • @subhasundardas
    @subhasundardas Před 9 měsíci +1

    Can I get future stock price using ml? How accurately will be it's output

    • @code2compass
      @code2compass Před 2 měsíci

      totally depending on your model tuning and feature engineering!

  • @ItsVinaySingh98
    @ItsVinaySingh98 Před 2 lety

    where is the prediction, what if i want to now just next future value
    what should i do then?

  • @Bill0102
    @Bill0102 Před 5 měsíci

    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

  • @anishakalra3714
    @anishakalra3714 Před 2 lety +1

    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?

    • @radicalpotato666
      @radicalpotato666 Před rokem

      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.

  • @sarathkumar-gq8be
    @sarathkumar-gq8be Před 7 měsíci

    how to predict next 10days future dataa

  • @vinod_reddy
    @vinod_reddy Před rokem

    Could you please send the base paper of project

  • @raven3715
    @raven3715 Před 3 lety

    Shouldnt we do cross-validation also?

  • @sandipmahato4049
    @sandipmahato4049 Před 8 měsíci

    Why shifting +1, +2, +3, i m not able to understand that part

  • @anilkumarsharma8901
    @anilkumarsharma8901 Před 2 lety +1

    Dus tarah key indicated banao mix average score batao

  • @wyldcard00
    @wyldcard00 Před rokem

    you did not explain how to do the forecast on the entire dataset

  • @appleprix9543
    @appleprix9543 Před rokem

    Heiiin you're calling an classification model on an quatitative target ? ! you didint even binarize your features !

  • @divyanshuchaudhari5416
    @divyanshuchaudhari5416 Před 3 lety +4

    Man, atleast have the courtesy to reply when clearly you don't have many comments to reply or anything.