Time Series Forecasting With RNN(LSTM)| Complete Python Tutorial|

Поділитися
Вставка
  • Опубліковано 23 сер 2024
  • In this video i cover time series prediction/ forecasting project using LSTM(Long short term memory) neural network in python. LSTM are a variant of RNN(recurrent neural network) and are widely used of for time series projects in forecasting and future predictions.
    I cover the complete code of the project and this tutorial is intended for beginners in the field of time series forecasting.
    Github Code(With data set): github.com/nac...
    Do subscribe to the channel and like the video if you want more videos like this!
    You can connect with me on my socials:
    Linkedin: / nachiketa-hebbar-86186...
    My 2nd UA-cam Channel: / @nachitalks
    My medium account(I publish blogs here): / nachihebbar
    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

КОМЕНТАРІ • 221

  • @smvnt3803
    @smvnt3803 8 місяців тому +6

    After spending hours reading documentation to understand everything... This short video was what I really needed!

  • @AlankritIndia
    @AlankritIndia 3 роки тому +45

    Too good brother! The entire LSTM code explained line by line with the underlying concepts within 15 min! Much appreciated. You're a great teacher!

    • @NachiketaHebbar
      @NachiketaHebbar  3 роки тому +1

      Thanks!

    • @gdpraveenkumar823
      @gdpraveenkumar823 3 роки тому +1

      @@NachiketaHebbar Hai
      Kindly make a video how to access GitHub programming file , alter the coding for our own dataset

    • @strongsyedaa7378
      @strongsyedaa7378 2 роки тому

      @@NachiketaHebbar
      What's the role of generators in time series?

    • @ruhiruhi9638
      @ruhiruhi9638 Рік тому

      Can u plz explain for LSTM model for exogenous variables

  • @hakamabushanab5430
    @hakamabushanab5430 3 роки тому +2

    Man, you are already an scientist, keep the great work

  • @AlphaRhoDelta
    @AlphaRhoDelta 8 місяців тому +1

    The fact that you're making it so clear and simple 👏👏👏

  • @AkshayGhadi01
    @AkshayGhadi01 2 роки тому

    You have become popular in my college, here in dublin..you are saving our life's here...simple and lucid videos...thanks a ton..

  • @sechabapeter
    @sechabapeter 3 роки тому +2

    You are the best Brother, Thanks for saving my life. Udemy couldn't explain it better than you

    • @NachiketaHebbar
      @NachiketaHebbar  3 роки тому +1

      Glad to help, and thanks for such a kind comment!

  • @farhatiqb
    @farhatiqb 3 роки тому +28

    Well explained. Can you please make a tutorial on Multivariate (explanatory variables) Multistep (more than 1 step ahead) time series forecasting using LSTM?

    • @SimplytheBest23
      @SimplytheBest23 Рік тому

      Did you find any good video for LSTM Multivariate Model?

    • @farhatiqb
      @farhatiqb Рік тому

      @@SimplytheBest23 No.

    • @quantlfc
      @quantlfc Рік тому

      I think you can write your custom training and test data generation functions for this, and then just plug it into an LSTM. Don't use the TimeSeriesGenerator provided by keras.

  • @erickarwa-0705
    @erickarwa-0705 2 роки тому +1

    For the first time, I have found one that helps me follow the whole concept. Thank you.
    And that time series generator was new to me. It makes the work quite simple.

  • @robertandrews7211
    @robertandrews7211 Рік тому +1

    This video was so helpful. You did a very nice job explaining how the batch training of predictions works. Thank you, Nachiketa!

  • @Mrmayanksanadhya
    @Mrmayanksanadhya 2 роки тому

    it is the best video for LSTM on UA-cam.

  • @thinhnguyenlong152
    @thinhnguyenlong152 3 роки тому +1

    Many thanks, Hebbarm!!! you really save my days with this tough one

  • @kaianchan7768
    @kaianchan7768 2 роки тому +9

    Thanks for the tutorial. Btw, can you provide the tutorials on multi-variate and multi-step method on time series prediction? It's also a popular and useful topics. Thanks!!!

  • @MouseWhisperer11
    @MouseWhisperer11 Рік тому

    This is a very well presented and articulated walkthrough. Good work.

  • @girishchhonkar9391
    @girishchhonkar9391 2 роки тому

    Always love your content !!!keep making videos man

  • @prafulh5252
    @prafulh5252 2 роки тому

    Please do a Video on Multivariate Time Series modelling using LSTM. I like the your natural way of explanation..! keep it up!

  • @sasindumadushan9863
    @sasindumadushan9863 2 роки тому

    This video was help me lot to do my research... thanx brother... please do more content like this. you are awesome

  • @VCodes
    @VCodes 2 роки тому +1

    short and to the point. thx a lot.

  • @zamazenta1728
    @zamazenta1728 Рік тому

    Beautifully explained!!! Thanks a lot.

  • @rgmgurukula
    @rgmgurukula 7 місяців тому

    Thanks Bhai. Got one SCI publication in Q2 based one your video❤❤❤❤❤

  • @amjedmohammed2677
    @amjedmohammed2677 14 днів тому

    Thanks, very good explanation

  • @venkatesh532
    @venkatesh532 3 місяці тому

    Good job Boy!!! Well explained

  • @nextReanimation
    @nextReanimation 2 роки тому +1

    How should I change the code for future predictions? If I am happy with the modell, how do I apply it to the whole dataset to truely predict values in the future?

  • @prasannalahiru
    @prasannalahiru 3 роки тому +3

    how do we predict another three months production using this?

  • @Ankit-hs9nb
    @Ankit-hs9nb 2 роки тому

    simple and precise bro! awesome!

  • @manojrangera
    @manojrangera 3 роки тому +2

    Multivariate time series...

  • @Mavyrle
    @Mavyrle 3 роки тому

    Best tutorial EVER

  • @felipecallpa3757
    @felipecallpa3757 3 роки тому +1

    Thanks !!!!!! i love uuuuuu for this hahaha i use this for my work :)

  • @MuhammadImran-oc3vi
    @MuhammadImran-oc3vi 2 роки тому +2

    Hi,
    "Cannot convert a symbolic Tensor (lstm_11/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported"
    How to resolve this type of problem?????

    • @ramirotapia2217
      @ramirotapia2217 2 роки тому +1

      Same problem here with:
      model.add(LSTM(100, activation='relu', input_shape=(n_input, n_features)))

  • @mzwandilemhlongo7074
    @mzwandilemhlongo7074 3 роки тому +3

    Yho! I am a new to RNN yet your Video was very informative. I enjoyed your approach and how simplified you made it look.
    When you get a chance, Could you please do Multivariate Forecasting. Thank you.

  • @psii
    @psii 2 роки тому

    Really helpful, keep making such videos

  • @adrianrs79
    @adrianrs79 2 роки тому

    Really good video, well done, subscribed!

  • @mgfg22
    @mgfg22 2 роки тому +1

    I have two questions;
    1) How can we make this dataset stationary?
    2) How to optimize the hyperparameter of the LTSM algorithm?I have two questions;
    Thank you :)

  • @opm-sriram2070
    @opm-sriram2070 2 роки тому +1

    nice explanation nachiketa, have a small doubt how to deal if there are multiple time series involving various products?

  • @jeyasheelarakkinimj6534
    @jeyasheelarakkinimj6534 Рік тому

    i found this really simple and handy

  • @nehapant1027
    @nehapant1027 2 роки тому

    Very well explained. Thank you so much.!!!

  • @hamzah7719
    @hamzah7719 День тому

    Very helpful. I applied the model on my data, but I have weak result. I need to contact with you If you don't mind.

  • @gdpraveenkumar823
    @gdpraveenkumar823 3 роки тому +1

    @Nachiketa Hebbar ,
    Hai
    Kindly make a video how to access GitHub programming file , alter the coding for our own dataset

  • @todorowael
    @todorowael 4 місяці тому

    Great explanation, thank you!

  • @NAMURecords
    @NAMURecords 3 роки тому +3

    Hello, great Tutorial! I tried to reconstruct your tutorial and ran into an error in this line:
    model.add(LSTM(100, activation='relu', input_shape=(n_input, n_features)))
    I get the Error:
    NotImplementedError: Cannot convert a symbolic Tensor (lstm/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported
    Do you have an Idea whats the problem?
    Thanks in advance!

  • @uni1357
    @uni1357 3 роки тому +1

    Thanks for the video. So let's say that i have 120 days in my training set and 20 days in my test set. What should be the n_input in this case? Thank you!

  • @danielniels22
    @danielniels22 2 роки тому +1

    Can you recommend some references (videos or articles) on model that receive multiple input and also spit out (predict) multiple output? Like predict unit sales, how many customers, and such things.

  • @SandipRijal-yi2qj
    @SandipRijal-yi2qj Рік тому

    Your have explained it with great enthusiasm, really liked your video. I am following your video and notice that if n_input value are increased from 10 to let's say 30, validation loss increases enormously for daily data. Could you explain why is it so?

  • @roselinekolony2470
    @roselinekolony2470 11 місяців тому

    Thank you so much, just have one question why are you using the relu activation function and not the sigmoid or the tanh?

  • @meetmota1667
    @meetmota1667 3 роки тому +2

    Can you please help on deploying LSTM Model?

  • @ywf98
    @ywf98 2 роки тому

    thanks this video for make me easy to understanding and i will make reference for my thesis trial :) hehe

  • @nitheeshrkm1858
    @nitheeshrkm1858 Рік тому +1

    can you make another video for multi feature time series forecasting?i couldnt figure out what to do for that

  • @octaviogodoy4153
    @octaviogodoy4153 Рік тому

    Nice video man, now I do have a question. How do you perform a forecast out of sample for the next... let's say 12 periods ahead?

  • @Wissam-rk7tv
    @Wissam-rk7tv Рік тому

    thank you for this vidéo . iI have a qst , please how should we prepare our data if we have a lot of products ( we will have redondant date )

  • @thesundayjam22
    @thesundayjam22 2 роки тому +3

    Thank you for the great video! Just one question, why do we need to scale our series (if we are using only one series)?

    • @benslimanemohammed8121
      @benslimanemohammed8121 2 роки тому

      some models work better with numbers from 0 to 1, i think

    • @abhishekmazumdar2980
      @abhishekmazumdar2980 Рік тому

      The problem is not about having multiple features and single features in this case. Think of univariate time series as a multi-feature problem where the scale within the time series has a large range. Hence, as we do scaling for traditional models, we also scale it down for time series data. You can try without doing so, and you will see a very large loss value

  • @quantlfc
    @quantlfc Рік тому

    Love it!

  • @wuzzyjang5133
    @wuzzyjang5133 2 роки тому

    One quick question, I saw you remove the seasonality but you still used the original df in the model training. So can I understand that in this video you jut used the original dataset to train the RNN without removing the seasonality? TAHNKS!!

  • @syedmdnadeem2631
    @syedmdnadeem2631 2 роки тому

    Thanks bro.
    Nice tutorial on univariate LSTM .
    Request you to please make multivariate LSTM time series forecasting similar to ARIMAX using multiple exogenous variables.
    such predicting sale using exogenous variables like price, advertising spend, macro economics variable and events (dummy variables).

  • @baneledludlu7983
    @baneledludlu7983 3 місяці тому

    Wonderful Bro!

  • @arfanwicaksono8590
    @arfanwicaksono8590 3 роки тому

    you can add `squared=False` paremeter in mean_squared_error function to get RMSE value instead, cmiiw

  • @munmaheshyadav9308
    @munmaheshyadav9308 2 роки тому

    thank you so much.this is very help full video

  • @sucheths142
    @sucheths142 2 роки тому

    Hi
    Appreciate the effort for explaining the model ..pretty straight forward.
    Can you please tell me how to alter the code to get forecast for future 12 month's

  • @prabeshbista2920
    @prabeshbista2920 2 роки тому

    Really liked your video. I have a small doubt on the prediction: is it an in-sample forecast or out-of-sample forecast?

  • @manish5221
    @manish5221 3 роки тому +2

    This is a great channel with amazing content. Can you please make a video related to the recommendation models and how to deploy them using flask?.
    Again Thankyou the amazing videos.

    • @NachiketaHebbar
      @NachiketaHebbar  3 роки тому +1

      You're welcome. okay, I will try to cover recommendation systems in the future

    • @manish5221
      @manish5221 3 роки тому

      @@NachiketaHebbar Thanks, it will be great.

  • @vizdom
    @vizdom 2 роки тому

    So helpful ! brother thanks!

  • @jayamanimani2856
    @jayamanimani2856 2 роки тому

    Well Explained. My question is
    1. What i want to mention instead of parse_date = True and df.index.freq = ' ' .if my Index column is YYYY-DD-MM Hr:Min:Sec format.
    2. Is possible to consider epoch time stamp as index_col. if Yes what modification can i do to perform.

  • @jongcheulkim7284
    @jongcheulkim7284 2 роки тому

    Thank you so much. This is very help.

  • @tetakalapavani4167
    @tetakalapavani4167 Місяць тому

    All good,but my clg wants a dynamic output,hence I have to use some sensors,webcams,voice input through jupyter etc..😅😅

  • @didierleprince6106
    @didierleprince6106 Рік тому

    Bravo 😊

  • @PayneMaximus
    @PayneMaximus Рік тому

    How can we use multiple time series to make a prediction?
    You said that it would involve the n_features in the TimeSeriesGenerator, and I'm wondering how that works. I want to know how to predict by training the RNN with multiple other series that follow similar patterns.

  • @rainbowdu509
    @rainbowdu509 2 роки тому

    Very good explanation, thanks

  • @erfanfarzad286
    @erfanfarzad286 2 роки тому

    HI. thank you for what you did here. it is so helpful for me. actually I have a question. I try to ask that in your LinkedIn but it was impossible. how can I connect you?

  • @abhishekrameshnerkar2026
    @abhishekrameshnerkar2026 Рік тому

    Great Work Bro

  • @iotunlimit9164
    @iotunlimit9164 2 роки тому +1

    I have multiple variables.. does this help in multivariate forecasting?

  • @eduardhermesanschau9590
    @eduardhermesanschau9590 3 роки тому +1

    Hello. Do you know if the TimeSeriesGenerator class is a cross-validation method itself?

  • @hasithahiranrajapaksa5611
    @hasithahiranrajapaksa5611 3 роки тому

    Great explanation man.thank you very much ❤️❤️❤️

  • @rameshh3821
    @rameshh3821 3 місяці тому

    I have one doubt. [1,2,3] is used to predict [4]. Then [2,3,4] is used to predict [5]. In 2,3,4 shouldn't the 4 value be the actual instead of predicted? Why are we appending predicted value. Pls explain.

  • @dasgupts10
    @dasgupts10 2 роки тому +1

    n_input = 3 How do I decide the value?

  • @Yzyou11
    @Yzyou11 2 роки тому

    Nice yarr 👍👍

  • @minandach4974
    @minandach4974 10 місяців тому

    Hi i'm interested in deep learning . I fond this vidéo interesting but i've a l some confusions on predicting the wind speed using LSTM. Thé windowgenerator is a bit confusion on defining the parameters

  • @mohammedjabardi364
    @mohammedjabardi364 3 роки тому

    This is a great channel with amazing content. Suppose I have data for 100 weeks. Can you please, tell me how to forecasting the data for week 101.
    Again Thank You the amazing videos.

  • @adhvaithstudio6412
    @adhvaithstudio6412 3 роки тому +1

    if you could have explained why you have taken as 100 neurons as input..i mean any logic behind of 100 only....please reply it.

  • @sugamsharma5233
    @sugamsharma5233 10 місяців тому

    Great explanation bro.

  • @harshinisrinivasan1210
    @harshinisrinivasan1210 Рік тому +1

    Can you pls explain how to forecast for next few months

  • @prashantkumar-ur2ye
    @prashantkumar-ur2ye Рік тому

    Thanks bro, it's help me

  • @sowmiyar6505
    @sowmiyar6505 Рік тому

    Hi. I have a doubt. I exactly followed the same code but my predictions are straight pls could you help as where I had gone wrong.?

  • @oscarcentenomora
    @oscarcentenomora Рік тому

    Cool! But how we generate a IC for the forecast and test set?

  • @shuchisingh6189
    @shuchisingh6189 Рік тому

    What does basically mean of trend , seasonal and residual . How all of them is diffrent though?

  • @jaspartapsingh8774
    @jaspartapsingh8774 3 роки тому +1

    Hi Nachiketa, thanks for this gem of a video first of all :) Really appreciate
    Can you guide me on how can we use grid search to tune hyperparameters like optimizer, #epochs etc.

  • @K4pio
    @K4pio 2 роки тому

    I have a problem. I do exacly the same what you did and my model predict the same values. What can i do?

  • @ninavanleeuwen1183
    @ninavanleeuwen1183 4 місяці тому

    Thank you!

  • @U.akhtar
    @U.akhtar 2 роки тому

    Well explained, highly impressed by ur explanation... keep up the good work.. I have a request, please can u make a tutorial on ARIMA-LSTM Hybrid model or ARIMA-GRU!!
    Thanks in advance!

  • @faimanaeem9093
    @faimanaeem9093 6 місяців тому

    Hey
    I'm currently working on data which contain 19 values how i can make a code to forecast next 10 years values

  • @muchostudios3716
    @muchostudios3716 2 роки тому

    Great work

  • @sumodsundar1054
    @sumodsundar1054 2 роки тому

    Thank you. How to print Accuracy like MSE

  • @calebreigada210
    @calebreigada210 2 роки тому

    amazing video!

  • @MrsDyarvane
    @MrsDyarvane 2 роки тому +1

    Hi , i'm getting an error when i try to change the frequency to Day, the Alias im trying to use is "D" instead of "MS" but i'm getting an error and i'm still getting an error.

    • @aroundwithbae5193
      @aroundwithbae5193 Рік тому

      its monthly data so he explicitly defined it as MS . Its not daywise data so it wont convert to days for u

  • @islamisthepath786
    @islamisthepath786 2 роки тому

    can this be used in a multivariable prediction? where we have more than one columns in a dataset but we want to only predict one column?

  • @benco-gi1zn
    @benco-gi1zn 2 роки тому +2

    Hello !
    Thank you for this video ! :)
    But I have a question : How do you deal with a problem where you have to take into account the seasonality (like in the video), but also other variables (for example it could be the turnover, the number of clients...)

  • @adnanmajeed4825
    @adnanmajeed4825 3 роки тому

    great work! the wondering to know about there is an error in line results = seasonal_decompose(df['d'])
    results.plot();

  • @AlankritIndia
    @AlankritIndia 3 роки тому

    Hi Nachiketa, I was using your code for my quarterly data with n_input=4, but model is not capturing seasonal pattern at all.. Any suggestion?
    Thanks.

  • @52_it_nikhilpoojari61
    @52_it_nikhilpoojari61 Рік тому

    at line model.predict(last_train_batch) my output is array([[nan]],dtype=float32) i dont know whats wrong in program

  • @danielminchev4173
    @danielminchev4173 2 роки тому

    I think you should use standard scaler in order to fit better

  • @parrot-media
    @parrot-media 3 роки тому +1

    Thanks a lots Bro! But How to compute an accuracy measure based on RMSE? foreexample on your case RMSR is 26.04. so what is the accuracy of the model in %?? please help me ! please ! I am comfused!

    • @nelsymtsweni7325
      @nelsymtsweni7325 Рік тому

      Here is the answer:
      import numpy as np
      import pandas as pd
      from sklearn.metrics import mean_absolute_percentage_erro
      # Assuming you have the true test values in a 'TrueValues
      # test['TrueValues'] = true_values
      # Calculate the MAPE (Mean Absolute Percentage Error) bet
      mape = mean_absolute_percentage_error(test['Production'],
      # Convert MAPE to percentage format (0-100)
      percentage_accuracy = (1 - mape) * 100
      # Display the percentage accuracy
      print(f"Percentage Accuracy: {percentage_accuracy:.2f}%")

  • @bayasherif6390
    @bayasherif6390 2 роки тому

    thanks, well explained 👏

  • @maaleem90
    @maaleem90 Рік тому

    Brother , in timeseriesGenerator ( ) , what does batch_size refer to, does it refer to number of columns or is it same as batch_size we apply in model. Fit() .