Stock Price Prediction Using Python & Machine Learning

  Рет қаралды 1,278,894

Computer Science

Computer Science

Күн бұрын

Stock Price Prediction Using Python & Machine Learning (LSTM).
In this video you will learn how to create an artificial neural network called Long Short Term Memory to predict the future price of stock.
Disclaimer: The material in this video is purely educational and should not be taken as professional investment advice. Invest at your own discretion.
NOTE: Some errors in the video:
(1) In the video to calculate the RMSE I put the following statement:
rmse=np.sqrt(np.mean((predictions- y_test)**2))
When in fact I meant to put:
rmse=np.sqrt(np.mean(((predictions- y_test)**2)))
You can also use the following statements to calculate RMSE:
1. rmse =np.sqrt(np.mean(((predictions- y_test)**2)))
2. rmse = np.sqrt(np.mean(np.power((np.array(y_test)-np.array(predictions)),2)))
3. rmse = np.sqrt(((predictions - y_test) ** 2).mean())
(2) The preprocessing of data using MinMaxScaler resulted in data leakage, leading to the creation of future bias. Despite this, the code can still be utilized to obtain a basic understanding of Neural Network implementation in Python for classification and prediction purposes.
Please Subscribe !
⭐Get the code here⭐:
/ computerscience
⭐Please Subscribe !⭐
⭐Support the channel and/or get the code by becoming a supporter on Patreon:
/ computerscience
⭐Websites:
► everythingcomputerscience.com/
⭐Helpful Programming Books
► Python (Hands-Machine-Learning-Scikit-Learn-TensorFlow):
amzn.to/2AD1axD
► Learning Python:
amzn.to/3dQGrEB
►Head First Python:
amzn.to/3fUxDiO
► C-Programming :
amzn.to/2X0N6Wa
► Head First Java:
amzn.to/2LxMlhT
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
📚Helpful Financial Books📚
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
🌟Stock Market Investing Books:
✔️The Bogleheads' Guide to Investing
amzn.to/3s0icxA
✔️The Intelligent Investor
amzn.to/34Mj7t1
✔️A Random Walk Down Wall Street
amzn.to/3Bv0ghW
🌟Money Mindset Books
✔️Rich Dad Poor Dad:
amzn.to/3rZW6eE
✔️Get Good With Money: Ten Simple Steps To Becoming Financially Whole:
amzn.to/3I1UXc1
#StockPrediction #Python #MachineLearning

Пікірлер: 1 300
@merrymouse2008
@merrymouse2008 Жыл бұрын
Wonderful tutorial! Thank you very much for making it. I am making a project to impress the interviewer at the potential working place. I already did a prediction model using ML and Python but it was a simple Linear regression model. Thank you for your work. My model works perfectly. The only thing I can't figure out is how to trained it connected to timestamp. But otherwise it works. My tiny laptop CPU almost melted counting 38 000 rows of data XD
@Gamermiddleclass
@Gamermiddleclass Жыл бұрын
I am trying to make the same including the optimal time to buy and sell the stock . Give me tips if you have any .
@nelsondesantijunior1527
@nelsondesantijunior1527 4 жыл бұрын
Thank you for the video. Could you demonstrate how to use lstm with two input data, for example close price and volume?
@oy_oy
@oy_oy 3 жыл бұрын
The script here is in the right direction, naturally it needs two key columns: Add high/low/volume variables, since it represents people's sentiment and join a new dataset from other currencies. I would say low performance coins with the highest ones is a good combination.
@icutoo2699
@icutoo2699 2 жыл бұрын
The video was great, saved me a lot of time trying to figure it out myself. Also learn how to use the python syntax. On a side note, back of the envelope calculations. dec 17,19 aapl = 70.1, dec 17, 09 appl = 6.85. (70.1-6.85)/6.85 = 9.233 or 923% return over 10 years, 923%/10yr = 9.23%/year, 9.23%/365 days/yr = 0.0253%/day. If we use the previous day closing as an estimate plus the average daily change then, 70.1*(1.000253) = 70.118, accounting for the 1 to 4 stock split the price on the 18th is estimated at 70.1177 x 4 = 280.47, act close 279.74, vs AI 263.66. Would have been interesting to see which one would be better est, previous Close +% or AI, with the standard error.
@martinholmes3305
@martinholmes3305 3 жыл бұрын
Love the video, very intriguing. One really feels like repeating this program design with a pre-edited set of data to verify the accuracy of the hypothesis created by the viewing of it. It is like a psychological experiment, social experiment, statistical experiment, computer science lesson all rolled into one. Hello World of Python.
@krizh289
@krizh289 2 жыл бұрын
Would be fairly easy to verify the accuracy, you should do it
@Abdolahy
@Abdolahy 3 жыл бұрын
That was a great debut for me in this field, thank you so much for sharing this kind of stuff with us. :)
@arcsaber1127
@arcsaber1127 2 жыл бұрын
This video helped me a lot. I was struggling with the inputs to the Conv. Turns out it just required simple 3d inputs to fit and another 3d array input to predict
@PrabhuCS
@PrabhuCS 3 жыл бұрын
Ah! Beautifully expalined. May you reach 10 Million subscribers. Your classes are gold :)
@errolm8313
@errolm8313 4 жыл бұрын
thank you for this! Im new to python and was wanting to hone my skills and thought I'd embark a project to predict the stock price of a company.... one question...why didnt you use time series analysis? is the LSTM method more useful than time series analysis for predictions?
@ekinrota1638
@ekinrota1638 3 жыл бұрын
Just saw the video, thanks for the effort! One question though, isn't it leaking data when you do the scaling before splitting data into train/test sets?
@robertweber475
@robertweber475 2 жыл бұрын
you have to scale train and test data with the same parameters.. otherwise you distort results
@ekinrota1638
@ekinrota1638 2 жыл бұрын
@@robertweber475 yes but you can do that with scaling on train data first and using the same trained scaler on the test data
@robertweber475
@robertweber475 2 жыл бұрын
@@ekinrota1638 yes, that would be possible
@peterjamieson4082
@peterjamieson4082 2 жыл бұрын
@Jeremy Tran Jeremy is correct. The presentation is wrong and needs to be edited.
@anshumansingh2146
@anshumansingh2146 4 жыл бұрын
Very well planned video. This predictor can be helpful for getting trends and can be awesome. Thank You
@ChillbabaKaGyan
@ChillbabaKaGyan 4 жыл бұрын
Your video was very much helpful for me to learn and understand ML with stock market price prediction. Keep making such useful videos sir. Thank you once again for your time and efforts.
@KennTollens
@KennTollens 3 жыл бұрын
11:07 Lieutenant commander Data, nice rough estimated guess lol ! Thanks for the video, very useful.
@Bokgat
@Bokgat 3 жыл бұрын
But the shape of the predicted graph was uncannily accurate no? Surely something there? Did you watch the entire thing? Just asking and thanks for your post here. Cheers
@MrBobtwang
@MrBobtwang 4 жыл бұрын
I wouldn't put much store in the model created to be honest for reasons others have raised about scaling but as a 'get you going' video into the perilous world of trading using ML then it's an honest attempt - well done.
@tanmaysharma2742
@tanmaysharma2742 2 жыл бұрын
Hey you seem like an expert . Can you please guide me as I have been really wanting to get into trading and finance using machine learning. I would really appreciate it if you could give me resources that could get me industry ready to create complex algorithms that can help me out.
@loganathansiva7063
@loganathansiva7063 2 жыл бұрын
Thank you for your valuable sharing predictions on stock prices in a simple manner and lucid way of expressions.
@jjpmip
@jjpmip 7 ай бұрын
Amazing video. It went thru everything from start to finish and explained it very clear and was easy to understand what was exactly going on and how things worked. Thanks for such a great video.
@sriadityab4794
@sriadityab4794 3 жыл бұрын
Could you also please explain how to do cross-validation and hyperparameter tuning using LSTM?
@Gatolailo
@Gatolailo 4 жыл бұрын
45:43 how you predict 5 o 10 consecutive days... not just 1?
@AMA_RILDO
@AMA_RILDO Жыл бұрын
I’m always enjoy and bless the people like you who teaching cool stuff
@mstreich
@mstreich 4 жыл бұрын
When you show the Training data through mid 2018 (around 40:01 mark), and then Val and Predictions for future, is the model using incremental data from the points past the training data to develop the predicted value, or is it based simply on the future date values? In other words, if you didn't have actual values from mid 2018 to start of 2019, would the model have predicted that decline in price? (interesting demo of the tools and how to use them though)
@alexroseland9286
@alexroseland9286 4 жыл бұрын
I recreated this exact model and then checked to see how often the simple up/down movement of the price was correct (never mind the actual change amount), it couldn't reliably get better than 50% so it's basically the same thing as randomly guessing a slight up or down movement. So this was a cute demonstration of the concept but you'll definitely lose your ass if you tried to trade on anything like this haha. You need a vastly more complex model to start consistently getting higher than 50% and even then if there are large market corrections, they will definitely break your model. So Something like this might give you some minor assistance in day trading but you wont get rich one it. But anyways, we certainly appreciate the explanation on how general LSTM model functions
@martinholmes3305
@martinholmes3305 3 жыл бұрын
I am glad to see someone tried it while using only past data. The conclusion you make is what I would concur with just by simple reasoning. There should be a need for another factor at least to hope to get some sort of accuracy. Unless there is a repeated pattern to be found somewhere due to a factor we are unaware of. Like patterns in roulette due to flaws making the results not quite random. Something that has surely been caught onto, and is probably now verified for at casinos.
@ishanawasthi1975
@ishanawasthi1975 2 жыл бұрын
Actually this model will accurately tell you the range of values that the stock has high probability of trading in. Example if model prediction is 180 with rmse of 5 then there is 65% chance that it will close between 175 - 185 range, and there is 95% chance that it will close between 170 - 190 range given that stock returns are randomly distributed and it follows standard normal distribution. If someone knows the range maybe they can wait for the stock to hit either high or low before taking trade or they can deploy option strategies based on the information they got from the model.
@themoneymaker03
@themoneymaker03 2 жыл бұрын
@@ishanawasthi1975 good point!!! 👍
@Sachin-ww1ns
@Sachin-ww1ns 2 жыл бұрын
How can use multiple data as a input to classify which stock to pick ? from high to low. let's say I input 10 datasets at once & it classifies top 3. (just for project purpose)
@bloglifenguyen3028
@bloglifenguyen3028 2 жыл бұрын
His model is literally overfitting with the absurd accuracy
@robertjulesyoung9994
@robertjulesyoung9994 2 жыл бұрын
I think the markets are moving solely based on the psychology of the investors. therefore, technical analysis is the only valid approach. for example, it does not really matter how good a company is doing, if investors are paying attention, understanding their future. AI is making things a lot easier, by looking into investors' behavior. thanks for the great insight.
@SayuriFumico
@SayuriFumico 4 жыл бұрын
Hello CS, thanks a lot for the video! A question though, when you write "svr_rbf.predict(x)[0]", the [0] is for what please? thx
@mwredfern
@mwredfern 4 жыл бұрын
Love the video. And love the comments! So much learned here. Thanks for the post! 👍🏽
@MrArindamd
@MrArindamd 2 жыл бұрын
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 ?
@raghavverma120
@raghavverma120 2 жыл бұрын
Yeah! There was information leak in this demonstration
@pigmonpiggy5943
@pigmonpiggy5943 4 жыл бұрын
Thanks for the great video. Question: 1. Is there a way for LSTM to intake more than one variable? For example, using all the variable such as Close, Open, High and Low as input variable. 2.From what i see you are doing, is the LSTM a sliding window, using 60 data point to predict the 61st data point? How does that work for the testing dataset? Thank you
@lucasavila6928
@lucasavila6928 4 жыл бұрын
Hi! Regarding 1 yes, they're multi-variable LSTM. It's pretty similar to the example showed in the video, the main difference is that your X data instead of having a shape of [ feature1_a, feature1_b, feature1_c, ..] its going to have a shape like [ [feature1_a, feature2_a, feature3_a, ..], [feature1_b, feature2_b, feature3_b, ...] ]. Before you had one variable as input and now you have multiple variables per input (thus the array).
@evantarzian8495
@evantarzian8495 4 жыл бұрын
@@lucasavila6928 Hi Lucas. Really appreciate the video. Very helpful. Could you provide an example of the #Reshape the Data step using both Closing Price and Volume? Why could you not just replace the number of features from 1 to 2 as in the code below? x_train = np.reshape(x_train, (x_train.shape[0], x_train.shape[1], 2)) x_train.shape
@koushik7604
@koushik7604 4 жыл бұрын
Yes, all other variables can be incorporated, that is called multi-input time series. It is definitely a sliding window based approach and can be extended beyond a single day ahead forecast.
@gustavoreyes6442
@gustavoreyes6442 3 жыл бұрын
This has helped me a lot!! Thank you so much for the video
@R-Waze
@R-Waze 3 жыл бұрын
More videos like this, with different type of ML technique for stock prediction or Sell prediction in industry (like distribution), with more variety of technique, but with the same type of slow explanation. Super video, you definitely win my sub with this one. Thanks from the silent majority! 🤔
@gusinthecloud
@gusinthecloud 4 жыл бұрын
awesome, thank you very much for this video!! A big Hug from Argentina!!
@manuelpatricioacuna59
@manuelpatricioacuna59 3 жыл бұрын
Hola. Acabo de ver este video. Has intentado usar el código para invertir? De ser así, q tal salió todo?
@snivesz32
@snivesz32 4 жыл бұрын
The flaw nobody seems to have realized is that it’s predicting 1 day in the future GIVEN the last 60 days of actual values. So each prediction on the graph is actually using the validation data from yesterday + the NN prediction for today. Anyone can now see why it tracks the chart so accurately. I could get the same chart with a random number generator. Caveat emptor.
@diegotrazzi
@diegotrazzi 4 жыл бұрын
I see your point: if you seeded any number within 1 standard deviation form the previous day to predict today's price, then zooming out to a large timeframe you could get a very similar chart. You brought up a good point and seem to be knowledgeable on this topic, so what would you do to implement a better forecast model ? Suggestions are appreciated, thanks!
@weimondo
@weimondo 4 жыл бұрын
@@diegotrazzi It's not possible. Assuming a sufficiently efficient market, if it were possible to forecast asset prices then people would take advantage and trade on such information. Price actions would then disappear.
@RobertvonSarbacher
@RobertvonSarbacher 4 жыл бұрын
@@weimondo NOT TRUE that's a total fallacy - the whole insane and inane premise that you cannot predict the future to find for example - a cycle in the market that no one knows about it and make a profit off of it b/c everyone will eventually learn it and use it thus incorporating into the market therefore it is not longer a predictor - this whole premise is so absurb as to make even the term "laughing stock" blush - all you have to do is NOT tell someone else what you discovered and the prediction holds - take for example the Scandavian Finance professor in the 90s that discovered an 80% accurate super cycles that was so freakishly exact like to 1 or 2 day out of every 2 months ish in finding the total and absolute highs and lows of almost everything that occured every 2-3 months - but being a brainwashed bonehead - tells the whole world about it - it was then put onto every Media in the world like Nightly Business Report - the euro continents finance channel and all the finance channels in the USA - it stilll took 2 MONTHS to have it incorporated by rest of the world but in mean time predicted every major and sometimes even minor turns in the USA stockmarket (never mind every other stockmarket index on the planet ) - now despite the fact that that is MORE than enough to make a few billion dollars and retire - keep in mind had he not been a brainwashed bonehead and had he kept this info secret it would never have been known and never incorporated into the stockmarket at all.... is this not common sense - FEEL FREE TO NOT REPLY BACK GEEZZZZ
@dweh
@dweh 3 жыл бұрын
@Diego Trazzi There is the question that everyone in trading market are looking for! Who knows?
@drcesarvarela
@drcesarvarela 3 жыл бұрын
@@dweh I guess CITADEL LLC knows about it pretty well.
@malepatirahul7339
@malepatirahul7339 3 жыл бұрын
I think I have seen every tutorial on KZfaq for predicting the extrapolated price of stock and i found it in your video Thanks a lot for your time
@adolfolozaa
@adolfolozaa 4 жыл бұрын
Thank you. I love your videos about ML, I got a question, In don´t know if I am confuse, but in the last part, I don´t know where you are saying to predict the day ´18'?. I would like to modify it to ask the user the date that they want to predict.
@insoucyant
@insoucyant 4 жыл бұрын
Great flow and explanations. Please keep uploading such wonderful videos. :)
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 4 жыл бұрын
Thank you, I will
@pritigoel8662
@pritigoel8662 3 жыл бұрын
@@ComputerSciencecompsci112358 I found an error predictions=model.predict(x_test) predictions=scaler.inverse_transform(predictions) Output: Valueerror: Found array with dim 3. Estimator expected
@christospapageorgiou9560
@christospapageorgiou9560 4 жыл бұрын
Very good job! If you combine this with technical indicator values it will give you very good predictions. And probably split it to different timeframes. Also, I noticed that if you retrain the model until you get better results and then try to predict the prices you got accuracy near to 99%. So, with a combination of technical indicators and by retraining the neural network until it is more accurate you are getting great results! Excellent job! Great Video.
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 4 жыл бұрын
Thank you Christos !
@shogun9409
@shogun9409 9 ай бұрын
Can i get a video on how to combine the technical indicators to this pls? I am thinking of doing this as my final year project
@ZaraMaoki
@ZaraMaoki 3 жыл бұрын
I have problems, in the Valid['Predictions'] compilations says thats wrong, how can i solve?
@aashishkandel6112
@aashishkandel6112 2 ай бұрын
There are so much remaining to learn, but this was some intresting stuff. I learned about LSTM(Long Short Term Memory), taking the data from web directly, preprocessing the data,training the data and also visualizing the data.
@npomfret
@npomfret Жыл бұрын
It would be interesting to see how this compares with a basic strategy, like just predicting todays close will be the same as yesterdays close. I imagine the LSTM doesn't perform as well
@PoulJulle-wb9iu
@PoulJulle-wb9iu Жыл бұрын
Why do you imagine that?
@mrcc9589
@mrcc9589 4 жыл бұрын
Foremost.. great tutorial! I really enjoyed the practical example for the purpose of learning how to use LSTM in python. Regarding the results of the neural network: It is obvious that the predictions are chasing the trend, similarly how a simple moving average would do. But a good starting point for exploring the possibilities of a RNN.
@omkarmasal2148
@omkarmasal2148 4 жыл бұрын
What if I want to predict the for the date that is not in my train dataset i.e I would use my whole dataset as training dataset and would create a module 2 predict the future price?
@rajeshdua558
@rajeshdua558 4 жыл бұрын
I have seen 1000+ videos, read 1000+ articles on the internet. The best of the videos I have ever seen on machine learning.
@sahilsharma-gm1ed
@sahilsharma-gm1ed 4 жыл бұрын
Rajesh Dua chutiye .
@SebastianWaisgold
@SebastianWaisgold 7 ай бұрын
True
@AnonymUwo
@AnonymUwo 3 ай бұрын
Just look for Andrew Ng's courses. I'm sure it will change your mind
@inasissa8077
@inasissa8077 3 ай бұрын
Thank you for your response i will watch it after watching alot of video
@magicemail
@magicemail 4 жыл бұрын
Thank you for the video. I'm trying to visualize projected data for the next couple of weeks. I've been looking how you generated that one predicted value, I was wondering if there was a way I could edit that last cell to give X_test predicted values for the next week or so.
@omkarmasal2148
@omkarmasal2148 4 жыл бұрын
What solution you got for this!! How did you predicted for the date say 1 week next!!! Plz sen algorithm or reference
@weezyfbaby61
@weezyfbaby61 4 жыл бұрын
Thank you for the video, it is helpful to understand the logic behind this. Let suppose I want to add sentiments as another dimension for prediction, how would you include this in the code?
@mikethecoder341
@mikethecoder341 3 жыл бұрын
one change that can be done here is increasing epochs if your ram can handle , because that would increase accuracy. Great video!
@SahilKhan-td6rv
@SahilKhan-td6rv 3 жыл бұрын
Bro tell me what is the best value for epoch and batch size
@zalakborad617
@zalakborad617 5 ай бұрын
there is no best value found yet on planet earth, you have to try different combinations. @@SahilKhan-td6rv
@ItisAbuTDMM
@ItisAbuTDMM 2 жыл бұрын
Really enjoyed learning the LSTM application for stock price prediction. I noticed that the prediction has overfitting and this is probably because you have not included Dropout in your model. Thanks
@Lejik007
@Lejik007 4 жыл бұрын
Hi, how i change code for prediction prices only? what i mean, for example today 02/26/2020 and i want predict the prices of stocks for next 3 month, how i doing this? Thank You!
@martinholmes3305
@martinholmes3305 3 жыл бұрын
You might need to do the data processing to convert it to a comparable set when using multiple variables and statistical analyses you want before giving it to the neural network depending on the significant data sets you have?
@tomasemilio
@tomasemilio 4 жыл бұрын
I have 2 issues with this: 1. can't use testing data for the scaler. 2. I would predict a sequence instead of tomorrow's price. these plots are a bit deceiving because they are so close to each other but it is bc you are always using yesterday's close. It would be interesting to actually predict a sequence into the future.
@sifisojuniorhadebe476
@sifisojuniorhadebe476 Жыл бұрын
Yea that's true, I used a similar model projecting EURUSD but the spread between actual and projected averaged 100pips which is a nono
@LovingLego
@LovingLego 2 жыл бұрын
This is the best video of LSTM I saw. I don't understand why do some people dislike this video ?
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 2 жыл бұрын
Thank you very much !
@angelowattersr.5029
@angelowattersr.5029 4 жыл бұрын
just a question: one which ground (or paremeters) this model has come up at this conclusion ? a fall from $ 279 from the previous day to $ 263 it's a lot, specially for appl.
@tylerconner8204
@tylerconner8204 3 жыл бұрын
that's bc his model runs off of 60 days of predicted values. his model predicts an increase from 260 to 263, but it actually decrease from 280 to 279
@samha1513
@samha1513 4 жыл бұрын
*Good for learning purposes only*
@Gadgetoholic
@Gadgetoholic 4 жыл бұрын
And so I follow you now both on Github and YT... Thanks - great job!
@aadityapareek
@aadityapareek 3 жыл бұрын
can you please send the github link
@Gadgetoholic
@Gadgetoholic 3 жыл бұрын
@@aadityapareek Sure: github.com/randerson112358
@bhawishsingla3460
@bhawishsingla3460 4 жыл бұрын
On several training encounters, rmse keeps on varying, can you please throw some light on my concern..
@user-sb1wq6wj1c
@user-sb1wq6wj1c 10 ай бұрын
you are the big pro in trading! thank you for sharing your experience😄
@jianzuo4389
@jianzuo4389 3 жыл бұрын
Hello, Thanks a lot for this interesting instruction about stock price prediction. I am working on the prediction related to battery performance deterioration, so I have a few questions on the prediction part of the prediction algorithm. To my knowledge, the prediction part you proposed in the video can only make one step ahead prediction, right? Though the first algorithm you create a NumPy array contains test close stock price (many rows), but in your pred function, you iterate the prediction only based on the x_test, without the predicted close stock values. Is it possible to overcome this to help make a real prediction that can predict the stock price for a longer period, like 10 days, one month? Thank you very much.
@rohanshah8129
@rohanshah8129 2 жыл бұрын
This video is simply to demonstrate the implementation of LSTM. There are many factors to consider while making real predictions. Imagine if this was effecient way then wont all the LSTM algorithm makers be making huge profit 🤍
@touriafransform6280
@touriafransform6280 3 жыл бұрын
40:03 It is meaningless and misleading to plot predictions (especially zoomed out) unless you do out-of-sample forecasting. Many people are just obsessed with plotting forecast curves and comparing them with actual curves. It has got to stop! You can get a better fit by predicting the next value to be the current value. Out-of-sample forecasting is when the model is forced to predict N steps successively while not being provided with the true values of the previous time steps. Over time, errors would accumulate and the prediction curve would sway away from the actual curve. Only if you are doing out-of-sample forecasting, it makes sense to plot.
@leonidasat
@leonidasat 3 жыл бұрын
Hi! I agree with you. I'm new to this so I'd like to know if you see a way to deal with this problem so you can better predict the time series. Thanks!
@Otvazhnii
@Otvazhnii 2 жыл бұрын
Why predicting several steps? Why not predicting simply if it goes up or down in the next several steps? Is it not easier for a model to predict that?
@amandinelevecq6664
@amandinelevecq6664 2 жыл бұрын
@@Otvazhnii Maybe not easier to get the acurate direction, but a lot more useful 😄
@flygonfiasco9751
@flygonfiasco9751 4 жыл бұрын
A very nice introduction. Thank you
@efe8697
@efe8697 2 жыл бұрын
Thank you so much for this! Do you have this for non-US stocks not quoted on Yahoo?
@QuranKarreem
@QuranKarreem Жыл бұрын
Great ,but there is one small thing you missed which may introduce bias into your model. To avoid leakage from the test set into the training set, it is important to split the data before applying any preprocessing steps. This is because the preprocessing steps can introduce information from the test set into the training set, leading to overly optimistic performance estimates and poor generalization performance on unseen data. so you have to split the data before scaling
@neto_x
@neto_x 11 ай бұрын
I noticed this too...
@paultvshow
@paultvshow 5 ай бұрын
Exactly what I thought. I have noticed many KZfaq’s make some mistakes here and there too. I think they should be more professional to rely on.
@cbritton27
@cbritton27 4 жыл бұрын
Any reason why you are not using the adjusted close?
@rashidal-mahmud1917
@rashidal-mahmud1917 4 жыл бұрын
What activation function did you use? Relu and SoftMax may have been set to default. How come you never used dropout layers? Also you could have created the test/train data in one swoop with sklearn, makes life easier. Maybe remove anomalies from the dataset in the future, these sort of things have an impact on your model.
@XgameXish
@XgameXish 2 жыл бұрын
That's interesting but I ask myself if it's possible to consider the volume on the training. Typically to study the trend in a normal day trade, I don't use only the price, one primary factor(in my strategy) is to analyze the volume. Is it possible to do that? Or it's another type of ML?
@yx2023
@yx2023 4 жыл бұрын
For anyone criticising the effectiveness of this algorithm...you are missing the point. This is a very good FREE tutorial on applying LSTM & RNN to real world datasets using python, for learning purposes only. It's a standard and basic learning topic for Neural Networks. To criticise this would be same as saying Man City should win UCL every year based on their FIFA20 stats...
@yassinraissouni9130
@yassinraissouni9130 2 жыл бұрын
Hahahahaahahahahhaahhaha
@natih8585
@natih8585 4 жыл бұрын
I think this model is good for practice but not for real use. 1st issue is the scaling, you should scale based on the training set, not the full dataset, 2nd issue is the test dataset, the prediction works if you know the previous 60 days of the data for all the testing set. It would be good to see how is the performance of predicting next days (1+ days) just using a single vector of previous 60 days.
@MrEmzeezy
@MrEmzeezy 4 жыл бұрын
Good job, but I think you only wrote simple moving average using RNN. can you expand the dates and see what prices it predicts? THANK YOU for your tutorial!
@omkarmasal2148
@omkarmasal2148 4 жыл бұрын
What if I want to predict the for the date that is not in my train dataset i.e I would use my whole dataset as training dataset and would create a module 2 predict the future price?
@Mikey33X
@Mikey33X 4 жыл бұрын
Is the difference between this type of machine learning and something like a Monte Carlo simulation, is that this utilizes neural networks?
@atyabtosif584
@atyabtosif584 Жыл бұрын
Really nice tutorial, however if anyone could tell me why did we keep the range from 60 specifically for the xtrain and ytrain timeseries datasets, it would be a huge help
@adithyakondiparthy4797
@adithyakondiparthy4797 Жыл бұрын
0.3
@holaahora7527
@holaahora7527 4 жыл бұрын
Great video! Can someone explain to me why the input layer has 50 neurons and we pass 60 close prices each time, please? I thought that the number of neurons had to match with the number of inputs that we were passing. Thanks in advance :)
@vincenthughes5795
@vincenthughes5795 2 жыл бұрын
it's irrelevant, you've got input shape
@renanoliveira1719
@renanoliveira1719 3 жыл бұрын
I have tried to do the same procedure in the video with an equal stock dataset. I got an interesting problem. If you plot less data, something around 40 or 50 values, you probably will notice that the prediction line will follow the real line, but indexed one value before. I reviewed, compared, and confirmed that my code is the same. I don't found what is making this error happen. If someone have some idea leave your comment.
@liberadori
@liberadori 3 жыл бұрын
Cool video. Have you been able to predict the next 30 to 90 days as oppose to just the next day?
@tlayta8823
@tlayta8823 3 жыл бұрын
Hello great Video really helpful for understanding the concepts of LSTM models and stock price prediction 😊! I just have one question how can we add a dropout function in order to reduce overfitting and improve the performance of the model ?
@rohanshah8129
@rohanshah8129 2 жыл бұрын
Add it after your Lstm layer in similar way we do for ANN.
@nikhilrao6701
@nikhilrao6701 3 жыл бұрын
Can I have your GIT credentials and an amazing project. Loved the notes for each line and that voice is damn calming. It calms me down when i get an error.
@RandomGuy-hh4dk
@RandomGuy-hh4dk 3 жыл бұрын
Lstm remembers the context(in this case previous price) during the training process. I however, don't know in depth about this model. But if this model already takes in account the previous price history then what's the point of giving it 60 day's price history? Shouldn't we be better off giving other features like volume, high, low, e.t.c?
@sagaradoshi
@sagaradoshi 2 жыл бұрын
Hello..thank you for the explanation...I have one question on number of units which is set for example we wrote model.add(LSTM(50....)). If I understand correctly it mean we have 50 cells of LSTM connected in series in first layer ..right? if yes, how is the input fed to these cells? For example we have one row of input having 60 samples . Correct? so how are these 60 sample values connected to 50 cells? In short I would like to know how our 1543 samples of input where each input having 60 time steps given to each cell of 50 lstm cells in first layer? Looking forward for your support.
@jeepjr
@jeepjr 3 жыл бұрын
would have how to make a grid with leverage
@laurahaydee6007
@laurahaydee6007 2 жыл бұрын
Thank you so much for this tutorial, it was very helpful and I learned a great deal :) I have a question, if I want to predict more days should I change the number of neurons? Could you clarify this, please?
@rohanshah8129
@rohanshah8129 2 жыл бұрын
You will need to use for loop on the last cell he made for predicting next day value. The for loop will help to execute same lines of code for how many days you want to predict in future.
@jaybakerwork
@jaybakerwork 4 жыл бұрын
@ComputerScience - Did you copy this code from somewhere? I could be wrong but it sort of seems like it and I did not catch an attribution.
@FunWithBits
@FunWithBits 4 жыл бұрын
Not sure if it is related but it seems to be similar to this 2018 post : www.analyticsvidhya.com/blog/2018/10/predicting-stock-price-machine-learningnd-deep-learning-techniques-python/ . I did not catch any sources either in the video or text under it.
@aigarspetresevics7481
@aigarspetresevics7481 3 жыл бұрын
Hi, how do you predict for more than one day? say 14 days? Would you change the line X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1)) TO X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[14], 1)) ??? Which bit of code would you modify? OR can you specify this in the existing code by calling a function that allows you to specify the time steps?
@wmichaux6277
@wmichaux6277 4 жыл бұрын
Nice job. However, there is a small error in your equation for RMSE. You need to take the mean of the squared residuals rather than the square of the mean of the residuals.
@evandieterich8129
@evandieterich8129 4 жыл бұрын
w michaux can I send you some code to take a look at and maybe give me some pointers on what i can do better. my code runs im just not getting the results i intended and do not know where or why im stuck
@amidatongassassin
@amidatongassassin 4 жыл бұрын
If I'm not mistaken it is rmse = np.sqrt( np.mean( (predictions - y_test)**2 ))
@ashokwadel2502
@ashokwadel2502 Жыл бұрын
@@amidatongassassin nope getting the same error its giving me nan output
@Ronybech
@Ronybech 3 жыл бұрын
Using the previous value "yesterday" in the forecast, it is likely that the forecast will be more accurate. You need to predict for a more impressive period to assess the strength of the algorithm.
@finaldaylight3804
@finaldaylight3804 2 жыл бұрын
but what if i just want tomorrows prediction, shouldn't i be satisfied with that?
@flydr2
@flydr2 Жыл бұрын
Wow .. that's impressive... Very useful tutorial. Many thanks
@samscollo1333
@samscollo1333 3 жыл бұрын
Brilliant tutorial!!! thank-you very much.
@Asparuh.Emilov
@Asparuh.Emilov 4 жыл бұрын
Thank you so much for the great explanations! Very much appreciated! Is it actually poossible to use LSTM model to generate future predicted values with unknown true values? LIke actually use it for what we really need :D, predict the future values, not only the test set. Could you please create a video on how to do that?
@martinholmes3305
@martinholmes3305 3 жыл бұрын
LMAO... did you actually try it out?
@ashkansafari951
@ashkansafari951 4 жыл бұрын
Thank you for the video. How can I download the code?
@RTX_valorant
@RTX_valorant 4 жыл бұрын
In line 21 visualize data I can't understand plt.plot(valid[[]])why two square brackets needed please help 😵😵
@vedantkalan
@vedantkalan 4 жыл бұрын
I have an error in "predictions = scaler.inverse_transform(predictions)" which says "inverse_transform() missing 1 required positional argument: 'X' " Please help. Its Urgent
@aarensan
@aarensan 4 жыл бұрын
Thank you very much, that's awesome and very comprehensive. I also adapted this to any crypto so far. Works like a charm. But regarding the term prediction - for instance your current date is 12/21/2019 and you want to predict 12/22/2019 - that's not possible - because the web.Datareader set first of didn't has the information yet. Is there a possibility to make a 5 day lookout? 48:22
@hjluna7760
@hjluna7760 4 жыл бұрын
same question
@mohamednedal
@mohamednedal 4 жыл бұрын
Thanks for the great tutorial! A couple of questions please. To establish a Multivariate Multi-Step LSTM Models - Multiple Input Multi-Step Output: 1. How can I modify this code to take, for instance, 3 inputs to forecast a different single output that depends on those 3 inputs? 2. How can I forecast multiple timesteps in the future without knowing the new inputs (because they're in the future)?
@anujsrivastava5316
@anujsrivastava5316 4 жыл бұрын
Same doubt, anyone please share any resources about it?
@mvst4u493
@mvst4u493 2 жыл бұрын
@@anujsrivastava5316 If you find solution, Kindly mention
@folashadeolaitan6222
@folashadeolaitan6222 2 жыл бұрын
Hi guys, Did you find a way to do the multivariate?
@user-px7op1zc6m
@user-px7op1zc6m Жыл бұрын
Hello, I am plotting the graph of train, val, predictions. But my graph shows that the val, prediction are on the left tail(starting point of the graph) not the right tail. why is it? from the video, the data is in ascending order but my data is descending order.
@nilskohring
@nilskohring 4 жыл бұрын
It's crucial to square before taking the average when calculating the RMSE. Otherwise, any unbiased model should get a really low value with just enough data...
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 4 жыл бұрын
I made a mistake on the rmse calculation but have the correct code for it in the description.
@arupbiswas3487
@arupbiswas3487 4 жыл бұрын
model.add(Dense(25)) model.add(Dense(1)) This has resulted into RMSE of 0.38 , adding one more neural trace model.add(Dense(25)) may be the reason
@jeyasuriyam5185
@jeyasuriyam5185 3 жыл бұрын
why we take range as 60. Can you please explain
@kshitijsharma24
@kshitijsharma24 3 жыл бұрын
How to fetch prices of Indian stocks
@waelzayat2830
@waelzayat2830 4 жыл бұрын
That's pretty cool! thank you man. I just didn't know why you imported the pandas
@ComputerSciencecompsci112358
@ComputerSciencecompsci112358 4 жыл бұрын
Thanks for watching !
@pritigoel8662
@pritigoel8662 3 жыл бұрын
Hey bro do you have the source code? If yes, then can you please give it to me?
@ravibitragunta
@ravibitragunta 4 жыл бұрын
Thanks, its very insightful. Can you share a similar video on multi feature prediction?
@turnerpie
@turnerpie 3 жыл бұрын
What part of the code causes "pred_price" referencing "X_test" to be a single value but "predictions" referencing "x_test" to be an array of values?
@kolavithonduraski5031
@kolavithonduraski5031 4 жыл бұрын
i dont understand anything... but the voice is calming down... and it sounds interesting 😆👍 Thanks for the video. Maybe i will understand it in 2 Years or so 🤓
@delectomorfo
@delectomorfo 4 ай бұрын
Any luck?
@kolavithonduraski5031
@kolavithonduraski5031 4 ай бұрын
i started to research python+tensorflow, but i sadly didnt have time to stick to it. (i am just a hobby programmer)... BUT i appreciate you asking❗😁
@andrefonzar6222
@andrefonzar6222 4 жыл бұрын
Thanks for the video! I also got a question, how can you extend the prediction for the next 60 days for example ? thanks
@hjluna7760
@hjluna7760 4 жыл бұрын
same question
@EnochAppiah
@EnochAppiah 4 жыл бұрын
Try using incremental (online) learning. Create a loop to predict daily whiles updating your data with the predicted values incrementally.
@omkarmasal2148
@omkarmasal2148 4 жыл бұрын
What if I want to predict the for the date that is not in my train dataset i.e I would use my whole dataset as training dataset and would create a module 2 predict the future price?
@tobywong2110
@tobywong2110 11 ай бұрын
will the test set have data leakage problem? as it is feature-scaled before splitting
@mariahhayes5089
@mariahhayes5089 10 ай бұрын
Absolutely amazing video, I have finally realised that as a beginner in the financial investment market, you can achieve close to nothing yourself because you still have a lot to learn. Trading with a professional broker is more profitable and my advice for beginners is to always take advantage of that.
@raymondbarnes5264
@raymondbarnes5264 10 ай бұрын
Instead of timing the market, you should try to diversify your portfolio in order to get a dollar-cost average when it’s time to retire. Keep in mind that you don't need a ton of money to invest. Investing in small amounts can build long-term wealth too!
@greenquake11931
@greenquake11931 10 ай бұрын
I'm an amateur making terrible picks and I really need assistance.
@stellamoore720
@stellamoore720 10 ай бұрын
Trading is Profitable with the help of a seasoned broker managing your trading account .
@mariahhayes5089
@mariahhayes5089 10 ай бұрын
@@greenquake11931 'BRIDGET MARY TUROW"".
@greenquake11931
@greenquake11931 10 ай бұрын
@@mariahhayes5089 How can i reach her?.
@febrytriyadi3203
@febrytriyadi3203 4 жыл бұрын
I have an error in "predictions = scaler.inverse_transform(predictions)" "ValueError: Found array with dim 3. Estimator expected
@jonatasrf100
@jonatasrf100 4 жыл бұрын
Did anyone solve the problem?
@hakanunal4565
@hakanunal4565 4 жыл бұрын
RMSE requires 3 dimension be careful, you seem to have less than 3 dimension
@kennethmina7316
@kennethmina7316 4 жыл бұрын
Has anyone solved this problem?
@jackReme
@jackReme 11 ай бұрын
Thank you for this awesome tutorial!
@ivanpize
@ivanpize 4 жыл бұрын
Thank you a lot for this sharing of knowledge. A question: ........ did you predict two years (2018-2020) at once? ...... OR ........ you have predicted day by day (or week) every day during two years ???????
Predict The Stock Market With Machine Learning And Python
35:55
Dataquest
Рет қаралды 653 М.
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 45 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 8 МЛН
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 58 МЛН
I Can't Believe We Did This...
00:38
Stokes Twins
Рет қаралды 130 МЛН
I Built a Trading Bot with ChatGPT
18:33
Siraj Raval
Рет қаралды 1,8 МЛН
Algorithmic Trading Strategy Using Python
31:57
Computer Science
Рет қаралды 430 М.
Predicting Stock Prices in Python
29:14
NeuralNine
Рет қаралды 528 М.
Long Short-Term Memory (LSTM), Clearly Explained
20:45
StatQuest with Josh Starmer
Рет қаралды 517 М.
Python Machine Learning Tutorial (Data Science)
49:43
Programming with Mosh
Рет қаралды 2,8 МЛН
181 - Multivariate time series forecasting using LSTM
22:40
DigitalSreeni
Рет қаралды 271 М.
Build A Killer Stock Portfolio Using Python
28:53
Computer Science
Рет қаралды 201 М.
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 246 М.
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 15 МЛН
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,8 МЛН
Самый тонкий смартфон в мире!
0:55
Не шарю!
Рет қаралды 91 М.
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 968 М.