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

Sdílet
Vložit
  • čas přidán 29. 08. 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 CZcams 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

Komentáře • 221

  • @smvnt3803
    @smvnt3803 Před 8 měsíci +7

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

  • @AlankritIndia
    @AlankritIndia Před 3 lety +46

    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  Před 3 lety +1

      Thanks!

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

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

    • @strongsyedaa7378
      @strongsyedaa7378 Před 2 lety

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

    • @ruhiruhi9638
      @ruhiruhi9638 Před rokem

      Can u plz explain for LSTM model for exogenous variables

  • @hakamabushanab5430
    @hakamabushanab5430 Před 3 lety +2

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

  • @AlphaRhoDelta
    @AlphaRhoDelta Před 8 měsíci +1

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

  • @farhatiqb
    @farhatiqb Před 3 lety +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 Před rokem

      Did you find any good video for LSTM Multivariate Model?

    • @farhatiqb
      @farhatiqb Před rokem

      @@SimplytheBest23 No.

    • @quantlfc
      @quantlfc Před rokem

      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.

  • @sechabapeter
    @sechabapeter Před 3 lety +2

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

  • @AkshayGhadi01
    @AkshayGhadi01 Před 2 lety

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

  • @robertandrews7211
    @robertandrews7211 Před rokem +1

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

  • @erickarwa-0705
    @erickarwa-0705 Před 2 lety +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.

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

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

  • @Mrmayanksanadhya
    @Mrmayanksanadhya Před 2 lety

    it is the best video for LSTM on CZcams.

  • @kaianchan7768
    @kaianchan7768 Před 2 lety +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!!!

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

    short and to the point. thx a lot.

  • @manojrangera
    @manojrangera Před 3 lety +2

    Multivariate time series...

  • @MouseWhisperer11
    @MouseWhisperer11 Před rokem

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

  • @prafulh5252
    @prafulh5252 Před 2 lety

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

  • @rgmgurukula
    @rgmgurukula Před 7 měsíci

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

  • @sasindumadushan9863
    @sasindumadushan9863 Před 3 lety

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

  • @amjedmohammed2677
    @amjedmohammed2677 Před 20 dny

    Thanks, very good explanation

  • @MuhammadImran-oc3vi
    @MuhammadImran-oc3vi Před 2 lety +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 Před 2 lety +1

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

  • @girishchhonkar9391
    @girishchhonkar9391 Před 2 lety

    Always love your content !!!keep making videos man

  • @zamazenta1728
    @zamazenta1728 Před rokem

    Beautifully explained!!! Thanks a lot.

  • @jeyasheelarakkinimj6534

    i found this really simple and handy

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

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

  • @mgfg22
    @mgfg22 Před 2 lety +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 :)

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

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

  • @Ankit-hs9nb
    @Ankit-hs9nb Před 2 lety

    simple and precise bro! awesome!

  • @tetakalapavani4167
    @tetakalapavani4167 Před měsícem

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

  • @mzwandilemhlongo7074
    @mzwandilemhlongo7074 Před 3 lety +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.

  • @ywf98
    @ywf98 Před 2 lety

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

  • @manish5221
    @manish5221 Před 3 lety +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  Před 3 lety +1

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

    • @manish5221
      @manish5221 Před 3 lety

      @@NachiketaHebbar Thanks, it will be great.

  • @venkatesh532
    @venkatesh532 Před 4 měsíci

    Good job Boy!!! Well explained

  • @nehapant1027
    @nehapant1027 Před 2 lety

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

  • @nextReanimation
    @nextReanimation Před 2 lety +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?

  • @Mavyrle
    @Mavyrle Před 3 lety

    Best tutorial EVER

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

    Great explanation, thank you!

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

    how do we predict another three months production using this?

  • @psii
    @psii Před 2 lety

    Really helpful, keep making such videos

  • @adrianrs79
    @adrianrs79 Před 2 lety

    Really good video, well done, subscribed!

  • @mohammedjabardi364
    @mohammedjabardi364 Před 3 lety

    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.

  • @munmaheshyadav9308
    @munmaheshyadav9308 Před 2 lety

    thank you so much.this is very help full video

  • @arfanwicaksono8590
    @arfanwicaksono8590 Před 3 lety

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

  • @SandipRijal-yi2qj
    @SandipRijal-yi2qj Před rokem

    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?

  • @sucheths142
    @sucheths142 Před 2 lety

    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

  • @rainbowdu509
    @rainbowdu509 Před 2 lety

    Very good explanation, thanks

  • @thesundayjam22
    @thesundayjam22 Před 2 lety +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 Před 2 lety

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

    • @abhishekmazumdar2980
      @abhishekmazumdar2980 Před rokem

      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

  • @jongcheulkim7284
    @jongcheulkim7284 Před 2 lety

    Thank you so much. This is very help.

  • @prashantkumar-ur2ye
    @prashantkumar-ur2ye Před rokem

    Thanks bro, it's help me

  • @syedmdnadeem2631
    @syedmdnadeem2631 Před 2 lety

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

  • @Wissam-rk7tv
    @Wissam-rk7tv Před rokem

    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 )

  • @NAMURecords
    @NAMURecords Před 3 lety +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!

  • @vizdom
    @vizdom Před 2 lety

    So helpful ! brother thanks!

  • @meetmota1667
    @meetmota1667 Před 3 lety +2

    Can you please help on deploying LSTM Model?

  • @harshinisrinivasan1210
    @harshinisrinivasan1210 Před rokem +1

    Can you pls explain how to forecast for next few months

  • @opm-sriram2070
    @opm-sriram2070 Před 2 lety +1

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

  • @sugamsharma5233
    @sugamsharma5233 Před 10 měsíci

    Great explanation bro.

  • @hasithahiranrajapaksa5611

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

  • @rameshh3821
    @rameshh3821 Před 3 měsíci

    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.

  • @ninavanleeuwen1183
    @ninavanleeuwen1183 Před 4 měsíci

    Thank you!

  • @didierleprince6106
    @didierleprince6106 Před rokem

    Bravo 😊

  • @Yzyou11
    @Yzyou11 Před 2 lety

    Nice yarr 👍👍

  • @hamzah7719
    @hamzah7719 Před 7 dny

    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.

  • @U.akhtar
    @U.akhtar Před 2 lety

    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!

  • @jaspartapsingh8774
    @jaspartapsingh8774 Před 3 lety +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.

  • @CarryBrahHighlightReel

    Thank you so much

  • @danielniels22
    @danielniels22 Před 2 lety +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.

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

    n_input = 3 How do I decide the value?

  • @siddhigolatkar8558
    @siddhigolatkar8558 Před rokem

    Thank you 😀

  • @nitheeshrkm1858
    @nitheeshrkm1858 Před rokem +1

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

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

    Thanks bro, this is a great and easy way of description ; if it is possible, would you mind to prepare multivariate LSTM based time series model? With much respect🙏🙏🙏

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

      Sure, will try to make a video on it

    • @bhaskara2008
      @bhaskara2008 Před 3 lety

      If possible please create video for multivariate time series forecasting(without LSTM) with Graph Neural Networks

    • @mp3311
      @mp3311 Před 2 lety

      @@NachiketaHebbar did you manage to do the multivariate LSTM? :) Great explanations

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

      but still you didn't bro🤥

  • @bayasherif6390
    @bayasherif6390 Před 2 lety

    thanks, well explained 👏

  • @Anuj_MARC_SolarDynasty

    Thanks for making such learning video. Can you make one more video ON LSTM which predict future data

  • @adhvaithstudio6412
    @adhvaithstudio6412 Před 3 lety +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.

  • @MrsDyarvane
    @MrsDyarvane Před 2 lety +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 Před rokem

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

  • @jayamanimani2856
    @jayamanimani2856 Před 2 lety

    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.

  • @danielminchev4173
    @danielminchev4173 Před 2 lety

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

  • @uni1357
    @uni1357 Před 3 lety +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!

  • @muchostudios3716
    @muchostudios3716 Před 2 lety

    Great work

  • @baneledludlu7983
    @baneledludlu7983 Před 4 měsíci

    Wonderful Bro!

  • @LostGirlAt22
    @LostGirlAt22 Před rokem

    thank u so much......

  • @abhishekrameshnerkar2026

    Great Work Bro

  • @bhavs1648
    @bhavs1648 Před 2 lety

    My Data has hourly records for dates. It doesn't have all the hours. I can't view the Seasonal_Decompose because the freq can't be set.

  • @minandach4974
    @minandach4974 Před 10 měsíci

    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

  • @52_it_nikhilpoojari61

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

  • @shuchisingh6189
    @shuchisingh6189 Před rokem

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

  • @parrot-media
    @parrot-media Před 3 lety +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 Před rokem

      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}%")

  • @quantlfc
    @quantlfc Před rokem

    Love it!

  • @e_hossam96
    @e_hossam96 Před 2 lety

    Thank you

  • @roselinekolony2470
    @roselinekolony2470 Před 11 měsíci

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

  • @marienedeluna597
    @marienedeluna597 Před 3 lety

    can i have request can you do video for forecasting inflation rate with RNN(LSTM) i like all your videos i can easily learn

  • @octaviogodoy4153
    @octaviogodoy4153 Před rokem

    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?

  • @prabeshbista2920
    @prabeshbista2920 Před 2 lety

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

  • @aninditapanda9689
    @aninditapanda9689 Před 3 lety

    Man ...u r awesome... understood each and every part ..🤩🤩
    Can we also scale -ve numbers by the same method?

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

      All -ve numbers will be mapped to 0 by Minmax scale by default. If you want to keep negative values, you can mention feature range in Minmax scale as (-1 to 1).

  • @sumodsundar1054
    @sumodsundar1054 Před 2 lety

    Thank you. How to print Accuracy like MSE

  • @PankajKumar-tr2ib
    @PankajKumar-tr2ib Před 7 měsíci

    How to decide the number of neurons in the input layer like you have taken 100

  • @brianchaplin278
    @brianchaplin278 Před 2 lety

    Nice job

  • @calebreigada210
    @calebreigada210 Před 2 lety

    amazing video!

  • @sowmiyar6505
    @sowmiyar6505 Před rokem

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

  • @wuzzyjang5133
    @wuzzyjang5133 Před 2 lety

    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!!

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

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