Stock Price Prediction And Forecasting Using Stacked LSTM- Deep Learning

Поділитися
Вставка
  • Опубліковано 24 тра 2020
  • A Machine Learning Model for Stock Market Prediction. Stock market prediction is the act of trying to determine the future value of a company stock or other financial instrument traded on a financial exchange
    References: Jason Browniee Machine Learning Mastery Blogs
    machinelearningmastery.com/ti...
    github link: github.com/krishnaik06/Stock-...
    ⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for a few months and I love it! www.kite.com/get-kite/?...
    Please join as a member in my channel to get additional benefits like materials in Data Science, live streaming for Members and many more
    / @krishnaik06
    Please do subscribe my other channel too
    / @krishnaikhindi
    Connect with me here:
    Twitter: / krishnaik06
    Facebook: / krishnaik06
    instagram: / krishnaik06

КОМЕНТАРІ • 543

  • @dubaimetrodude
    @dubaimetrodude 4 роки тому +11

    First time I understood this LSTM. You have explained the LSTM very easily and in a very crisp manner.

  • @reverseengineer18
    @reverseengineer18 3 роки тому +4

    Easily the best video about the LSTM in UA-cam. Incredible explanation skill. Thank you for this priceless source Sir!

  • @aniketsharma1943
    @aniketsharma1943 3 роки тому +5

    "Wow!!" is the word for explanation skill.

  • @BytesVsStrings
    @BytesVsStrings 4 роки тому +3

    Very Impressive!!! Another gem from your treasury.

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

    Very good one in great detail!!
    Doing great job!!
    Keep Posting more..

  • @loganathansiva7063
    @loganathansiva7063 2 роки тому +2

    Very much impressed by the way you presented it. So simple and informative which no one shares as secret that is predicting nxt 30 days. Only few members share it in youtube. Hats off to you. Thanks and all the best for your future videos. May god bless you.

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

      I hope you understand that the reason nobody shares the „secret“ on how to predict the next 30 days of a stock price is… that these predictions are really really bad, right? I mean you get that?

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

    The best video that you can learn Machine Learning. Thank you for the video!

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

    Thanks for the video. This is the first video this concept is explained really well. Now I understand the code and can use it

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

    Krish, the best part in your teaching is... somehow, you match the audience frequency!

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

    Thanks so much...you really explained well...from the fundamentals to the applications.

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

    Beautifully explained...thanks a lot!!

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

    Great achievement and proof that the stock market can be predicted. Good luck!! ✊

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

      It can, proven, and consistently.. Search for Jim Simons.

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

    Hi Krish Sir, thank you for such an amazing explanation. Really liked it. It helped me in my project too.

  • @firstfacts99
    @firstfacts99 4 роки тому

    Beautiful Explanation, Thanks for video.

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

    This made my Day. Thank you so much Sir, for this Wonderful Tutorial.More power to you.

  • @preetkamal7424
    @preetkamal7424 3 роки тому +105

    I asked my teacher where should I start if I want to apply machine learning for stocks and he sent me this video.
    You are AMAZING. Thanks a lot sir!!

    • @rozsadnymarek5988
      @rozsadnymarek5988 2 роки тому +6

      Try to apply machine learning to coin toss or ask your teacher how to do that... lol.

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

      @@rozsadnymarek5988 lol 50 percent accuracy

    • @rozsadnymarek5988
      @rozsadnymarek5988 2 роки тому +2

      @@sayantanmazumdar9371 No more than in financial markets. ML is useles in forex. Believe me. I have 10 years of experience.

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

      @@rozsadnymarek5988 Hi dis ML works in stocks market or gives a good probability ?

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

      @@aminemihoub5269 *Unfortunately no!* You can try but you'll fail like everybody else. Sorry for destroing your wealthy dream. I tried many ultra-fancy ideas and most advanced algos and I never was able to get *stable and significant* accuracy. Stocks are a bit easier to predict, but they are also unprofitable.

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

    Great insite, love the content. I 'd like a piece of advice though! Would you recommend using the Multi-Step LSTM model for more than one output or re-using the single output as done above?

  • @SANJUKUMARI-vr5nz
    @SANJUKUMARI-vr5nz 3 роки тому

    Really, WONDERFUL . Many-many thanks sir.

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

    hi
    i have been watching some videos and so far this is the top related to this topic. keep going

  • @rohitnara6738
    @rohitnara6738 4 роки тому

    I am going to implement this in my project great job sir

  • @kvafsu225
    @kvafsu225 2 місяці тому

    Very good presentation. So clear and understandable. Thankyou

  • @tonycardinal413
    @tonycardinal413 2 роки тому +2

    excellent! Thank you. Doesn't the y_train and y_test need to be reshaped from one dimension to 2 dimensions? Or could we leave y_train and y_test as one dimension?

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

    Thank you very much. It was very helpful.

  • @KomalVerma-oo5nx
    @KomalVerma-oo5nx 3 дні тому

    may god give you more strength to make such valuable video man!! so grateful for you.

  • @1984ssn
    @1984ssn 3 роки тому

    Hi Krish your videos are great I have learned many things from you & I would like to thank you for such a great help. Just want to know if there is any framework or tool to tune NLP models with minimal effort?

  • @sachinnegi2161
    @sachinnegi2161 4 роки тому

    thankyou sir......nicely explained and for the code sharing

  • @taherkayamkhani8214
    @taherkayamkhani8214 4 роки тому

    Thank you sir for making video on stock prediction.

  • @sachinborgave8094
    @sachinborgave8094 4 роки тому +1

    Thanks Krish, please upload Deep Learning further videos.

  • @srishtisdesignerstudio8317
    @srishtisdesignerstudio8317 5 місяців тому

    very well demonstrated and useful content....

  • @devanshusisodiya9853
    @devanshusisodiya9853 4 роки тому +4

    Great video man, really inspired me to make a version 2 code of predicting stock market.

  • @SR-we1vl
    @SR-we1vl 4 роки тому +13

    Thanks for the video! Just one thing, how can we put dates in the x-axis in the graph and even future dates for prediction? Please reply!

    • @Atulmishra-hs8ch
      @Atulmishra-hs8ch 3 роки тому +7

      Set the index as DATE column. And for future dates, you need to use DateOffset method in a range.

  • @user-ff9uc3ye8v
    @user-ff9uc3ye8v 3 місяці тому

    thank you very much for the video
    :)

  • @MrArindamd
    @MrArindamd 2 роки тому +12

    First of all , thanks for a wonderful session. One question about scaling though. Shouldn't the MinMaxScaler be used to fit_transform the training data and then use the "fitted" scaler to the test data ?

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

      same question for me , because from jason brownlee sources , i've seen him using the scaler of fitted values on test data

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

    I can't thank you enough for this

  • @mundanephenomenon7438
    @mundanephenomenon7438 3 роки тому +5

    Hey, thank you for the video!
    Is there a way to convert the last plot units to match the whole numbers rather than the decimal?

  • @aandresriera7927
    @aandresriera7927 3 роки тому +18

    Let me congratulations first, I saw other videos that explain the same method using LSTM. However, you were the only one that made it predicting 30 days in the future, amazing! if you can make more videos like this maybe improving this method, explain it with all the details and logic behind it no matter if the video last 2 or 3 hours I'll see it. Finally an idea that you can make with this method is doing it with some other features using volume as an example and close price, instead of one feature, amazing.

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

      Really true! I would like to have the code

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

      Yeah I've done this with the features you r suggesting, it gave good accuracy.

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

      @@swatigupta3173 Did you have to predict the other features as well to feed the predictions back to the model?

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

      @@swatigupta3173 could you plese help me ?is there any way to convert those 30 values to actual stock price.

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

    very helpful!! thanks!

  • @AjaySharma-jv6qn
    @AjaySharma-jv6qn Рік тому

    Appreciate your effort;

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

    Hi ! Thank you for your video, very useful. I have a noob question though : if you want to predict the next day's value (I mean the first value of your lst_output). Which value do you have to rely on please ? df3[1259] (or lst_output[1]), correct ?

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

    I loved it !!
    It's a good video

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

    Thank you for this video

  • @lopabhattacharjee3845
    @lopabhattacharjee3845 4 роки тому +2

    Hi this is a very useful video what changes do I need to make for a multivariate LSTM?

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

    great video sir!

  • @anjaanaladka
    @anjaanaladka 4 роки тому +1

    Hey Krish,
    The video showcases the implementation of the LSTM beautifully.
    It was easy, will definitely try to implement and check the result with tweaks.
    Keep it up.
    Thanks for the upload.

  • @rahulbhatia5657
    @rahulbhatia5657 4 роки тому +11

    This is good from an academic point of view and learning about LSTMs and application, but I think that a lot more goes into building a robust profitable automated trading system, specially given the current situation(volatile market), anyways an informative video, keep up the good work!

    • @krishnaik06
      @krishnaik06  4 роки тому

      Yes I also agree

    • @ranjan4495
      @ranjan4495 4 роки тому

      @@krishnaik06 sir, can we do it for Indian market ?

    • @krishnaik06
      @krishnaik06  4 роки тому

      Yes we can

    • @hakeshkumar2508
      @hakeshkumar2508 4 роки тому +1

      Its doable if the data is available with a reading of 10 minutes interval of everyday from last 7 + years

    • @arjyabasu1311
      @arjyabasu1311 4 роки тому

      Does it really require that much data??

  • @lacorreia65
    @lacorreia65 3 роки тому +4

    Thanks for the video, I think the python explanation was good to understand how to put things together but I'm afraid the technical approach is very similar to the implementation of an auto-regressive model of a time series. Using only the historicity of closing prices might not be enough to have a good prediction model. Thanks anyway.

  • @dhanyadave6146
    @dhanyadave6146 3 роки тому +7

    Hi Krish, at 16:03. Shouldn't that be X_test ? Why are you calling it Y_train ?

  • @VijayKumar-pd8mu
    @VijayKumar-pd8mu 2 роки тому

    Thanks krish,
    you have explained step by step anyone can easily follow.
    I have gone through other videos related to stock market prediction but everybody saying don't use technique to predict regular stock market predictions
    can you please suggest any specific methods that i can try for regular stock market predictions.

  • @justinhuang8034
    @justinhuang8034 4 роки тому +8

    haha I'm reading Jasons book at the same time so this is perfect.

    • @hakeshkumar2508
      @hakeshkumar2508 4 роки тому +1

      Did you buy jason computer vision book?

    • @hakeshkumar2508
      @hakeshkumar2508 4 роки тому +1

      And how are jason brownlee time series books?

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

    thanks for a wonderful explanation, could i ask you explain how to predict next unseen nth days for multivariate LSTM models?

  • @radioactive11
    @radioactive11 4 роки тому +2

    You can also use yahoo to fetch the stocks data. It doesn't have api call restrictions

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

    Hello my friend, thank you very much for this video. I am having a question,.. What do you think the best model for stock market prediction?

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

    excellent explanation PROF:)

  • @mattmatt245
    @mattmatt245 4 роки тому +2

    Is this possible to apply a custom loss function in a regression model ? I'm working on stock market prediction model and I need to maximize the following loss function: if [predicted] < [actual] then [predicted] else [-actual]. Would that be possible ? Thanks

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

    Hey Sir, for the first prediction in the test data don't we need the last 100 values from the train data to have a continuous flow ?

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

    fantastic one of the best tutorial

  • @vatsalkachhiya5796
    @vatsalkachhiya5796 3 роки тому +5

    sir, you should have a created data-generator intend of creating the function creat_dataset it would save memory and time. Love your videos keep doing it.

  • @elsasuryana9111
    @elsasuryana9111 4 роки тому

    thanks a lot!

  • @9assahrasoum3asahboou87
    @9assahrasoum3asahboou87 2 роки тому

    thank you so much for this vidoes Tha

  • @geetanshkalra8980
    @geetanshkalra8980 3 роки тому +4

    Does the library support extraction of NSE and BSE stocks too?

  • @halojames7778
    @halojames7778 4 роки тому

    Thank you. 🙏🙏🙏

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

    That is what i am looking for...great vid, will definitely try this. Thank you.

  • @bhattvd1
    @bhattvd1 3 роки тому +4

    Wonderful tutorial, Krish. I appreciate your extra effort to explain the logic. You are a good teacher! I have one question, why are we seeing a discontinuity at the start of 30 days prediction?

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

      You can't make money this way. Ask the guy how much money he made !!! He probably sell books or work for some broker. That's how they make money - by gathering more "noise traders" who pay the spread and comissions to broker.

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

      @@rozsadnymarek5988 could you plese help me ?is there any way to convert those 30 values to actual stock price.

  • @technicaltrainings6429
    @technicaltrainings6429 4 роки тому +1

    cool sir.
    thankyou sir

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

    Inverse _transform should be applied to y_train and y_test also before finding score as scaling was applied on these two, right ?

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

    Thank you for this video

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

    It is good and helpful work . I have one question since the model is predicting. why is Date /Time value a decimal number rather than Date?

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

    great explanation

  • @michaelg.7124
    @michaelg.7124 2 роки тому +10

    Hi, this is a good tutorial about using LSTM in Python. BUT: it is the wrong application. When you zoom into the curve, e.g. day 1150 to day 1258, you can see that the "prediction" works pretty much like a low pass filter. That means: there is a lot of delay. Also, when you compare the performance using RSME of your example to a simple 1-step delay ( predicted cost for the next day = actual cost from actual day), the 1-step delay gives better results.

    • @ayansrivastava731
      @ayansrivastava731 9 місяців тому +2

      adding to this comment, the 'naive' forecast should be used as a threshold performance before evaluating any ML model

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

    Krish Sir,
    while calculating the RMSE value train_predict is inverse transformed, but y_train is not inversely transformed. Same with the test data. Please clarify if I am missing something.

  • @barunbodhak720
    @barunbodhak720 4 роки тому +2

    Thanks

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

    Naik सर great aahat tumhi 🙏💯

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

    excellent explanation, one question here, if we use [accuracy] option in model.fit....in time series analysis....it appears zero to all epoch....??

  • @amitrajput7642
    @amitrajput7642 4 роки тому +1

    First comment Sir please make videos on gsoc and projects related to it to which we can contribute . I have mailed you regarding the same.. ty for such valuable contents sir...

  • @j.williamb.c8984
    @j.williamb.c8984 4 роки тому +2

    Hey boy thanks so much meaning you from Mexico

  • @user-wethe9
    @user-wethe9 2 роки тому

    you are the best!

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

    Hi, Krish a question that I have is should'nt the minmax scaler be used to fit train data only and then on test set the scaler.transform() be used as otherwise it would create lookahead bias in our model?

  • @haneulkim4902
    @haneulkim4902 3 роки тому +4

    Thanks for you video. Could you explain why scaling is important here? It doesn't make sense why it would matter since we are only using one column. If there are more than one column it makes sense since two columns have different scales but why for one column?

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

      Because in LSTM neural networks we are using the activation function which takes only 0 and 1 that y we have to transform it 0 and 1

  • @ajaysingh-tv2nz
    @ajaysingh-tv2nz 4 роки тому +5

    Hi sir can you make a vedio on web scraping through python if possible I search alot on internet but no one teaching from basic.

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

    Thanks, actually this video explains the time series data very well. I am a bit confused that apart from Stacked LSTM, this video should not be in NLP playlist.

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

    Amazing...In 22:43, there is a table showing model summary....Can u please explain what information does each and every entry in this table tells us.

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

    Can you make a video on deploying a time series model using any web framework or cloud?

  • @shashwatshukla6226
    @shashwatshukla6226 4 роки тому

    Great Sir

  • @dr.chaluvadivraghavendran2462
    @dr.chaluvadivraghavendran2462 3 роки тому

    Thank you

  • @pawanpohani9333
    @pawanpohani9333 3 роки тому +4

    Hi, can you tell why you didn't do inverse scaling on y_train & y_test before calculating RMSE?

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

      If I understood your question correctly, it does not matter if we do inverse scaling or not, the RMSE value is going to be the same

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

    hi Krish!
    Great work!
    I have a question, how can I get data for INR/USD.
    Thanks

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

    Amazing, can u do multivariate time series with lstm with this dataframe too please?

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

    Thank you for your video
    I have something want to ask.
    So we don't need to care about metrics=['accuracy'], we only care about loss?
    Thank you

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

    Great video! Thanks.
    Is it possible to use the same data for validation and test (evaluation)? I am a little bit confused and unconfortable with that, I wouldn't use the same data, I guess...

  • @ChristianGarcia-ey9kj
    @ChristianGarcia-ey9kj 3 роки тому +2

    Hi Krish, Thank you for this great share. I encounter one problem : I have the exact period of AAPL stock data. I have report your line in a python doc. and at the end I have a flat prediction. Do you have an idea of that problem? my tensorflow version is 2.4.1. I have some dll error warning related to the GPU but nothing that avoid the process to complete. Thank in advance

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

      Hi, I encountered the same problem. Have you been able to fix it? Thank you in advance.

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

    Hi can you please take this in detail in live stream? It is very interesting big fan of your work !

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

    Hi Krish.!
    Great Info as usual.
    Can you please advise how we can check accurecy of this LSTM model?

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

    Hi Sir,
    Thanks for the amazing video.
    could you please help me with how should use this lstm model to create a web application.

  • @youssefkhachaf8258
    @youssefkhachaf8258 3 роки тому +27

    When you compute the mean squared error you used "train_predict" thier values 200,201 (not scaling) with "y_train" thier values are scaling ( betwen -1 and 1) so you get a big value of mean_squared error

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

      ^ more people need to see this (saved me)

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

      Yes kind of figured out when I got very large MSE and RMSE. Do you know how can this be fixed?

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

      @@badalsoni8000 2 solutions :
      - inverse scale y_train.
      - scale train_predict.

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

      @@youssefkhachaf8258 On inverse scaling y_train it shows error saying "Expected 2D array, got 1D array instead", how do we solve this?

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

      when you run the model on scaled data, you prediction should come between 0 to 1 (in case of min max scaler ) . so you can directly use both series to calculate MSE ,MAPE

  • @indianvaloggarpurnimam.8278
    @indianvaloggarpurnimam.8278 4 роки тому +1

    Good information stay Connect

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

    good, very good

  • @vipindube5439
    @vipindube5439 4 роки тому +2

    Dear Sir, If you are should not use for real world project then please mention the step also what kind of step should be consider in real world case study solution interms of stock prise prediction?
    Please provide your valuable feedback?

  • @riagoel2885
    @riagoel2885 4 роки тому +1

    @ Krish Naik sir please throw some light on multivariate time series analysis

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

    Hi kris. In example you are showing in tiingo method calling, do we need give api_key = ‘single code’? I used auth key and it’s giving max retires exceeds with url. Any idea about this error?

  • @madhureddy5328
    @madhureddy5328 4 роки тому +2

    Krish can you tell, what are the issues or different cases which can effect accuracy(with the dataset)

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

      Firstly is the residual values which means the distance between observed values and response value, in other words the gradient Descent, secondly relationship between the input variables also effect the accuracy of the model. Gradient Descent tells the goodness of the model. There are other factors also looking like data leakage.