Predicting Stock Prices - Learn Python for Data Science #4

  Рет қаралды 822,010

Siraj Raval

Siraj Raval

Күн бұрын

Пікірлер: 828
@KingpinRonin
@KingpinRonin 7 жыл бұрын
this is a video on learning code, not making money. the choice of the stock market as a subject is just a tool to create interest in the real subject of the video: coding ideas. I don't understand how people are so irate in this comments section about this. If the poster, or anybody, made real money with 40 lines of code... none of you would be posting here arguing about it, you'd be making money with 40 lines of code you found on a YT video. the stock market is just the frame for the idea.
@michaelheery7427
@michaelheery7427 5 жыл бұрын
Aleays remember ITS GAMBLING...
5 жыл бұрын
@@michaelheery7427 How is being a consistently profitable trader classed as gambling? Its rather contradictory? I suppose it depends on how you define the term gambling but atleast separate the consistently profitable traders from the haphazard emotionally driven buffoons by appending the prefix "professional" and rightfully referring to the former as "Professional Gamblers."
@philippedeleersnyder1232
@philippedeleersnyder1232 5 жыл бұрын
It is really blissful to share great opportunities like this. I never thought i would make it this far in just weeks with just trading and i give accolades to Iqd momentum Forex strategy. I was referred to the author Lukasz Wilhelm only in December of last year after watching series of Siraj Raval wonderful videos on youtube and my life has changed so much since then. Thank you Man .
@informativecontent4778
@informativecontent4778 5 жыл бұрын
Fuckoff
@rushikeshdhamecha9482
@rushikeshdhamecha9482 Жыл бұрын
Dude, the way you explain the things... easily and with fun. The best teacher ever I know. Thank you for these amazing video lessons.
@vedankgoyal1706
@vedankgoyal1706 4 жыл бұрын
This was just regression. One can't just use regression to "predict" stock prices as everyday the parameters involved are changing. Stock prices prediction involves a lot of different statistical concepts like Brownian Motion, Random Walk etc. There are different models in finance like Black-Scholes equation, Monte Carlo Simulation etc. which take into account these parameters. You have to know a decent amount of math to build a stock prediction algorithm
@sorvex9
@sorvex9 2 жыл бұрын
lmfao, even if you know a 'decent amount of math' you still can't predict stock prices. If you can't predict human behaviour, you can't predict stock prices. Period. What you can use math for, is to capture very short-term trends and buy/sell in very high frequencies using a computer.
@rameshramachandran698
@rameshramachandran698 8 жыл бұрын
This is a toy example. To build a system that works you would need to use Deep Reinforcement learning. And approach the stock market similar to playing a game. The system should be able to identify Good Risk to Reward setups and continuously monitor price action to ascertain whether the odds have changed. It is not enough to just predict the price action. The system should provide a good entry price a stop loss price and a profit exit price.
@SirajRaval
@SirajRaval 8 жыл бұрын
good point thanks Ramesh
@washfi
@washfi 7 жыл бұрын
lol.... this model is all bulls hit.... common sense... make money..... the idea is very simple dear..you don't need 180 IQ to make make money in stock market nor you need any fancy financial model... these are all look Gud and seems interesting. The truth is that any dumb guy can make money in stock market... timing is impossible... it is time in the market and holding period that matters... quarter to quarter earning and reporting don't works... rest is the history...
@bluebull399
@bluebull399 7 жыл бұрын
A good trader can just look at a naked chart and if he sees recurring patterns he knows he has a high probability of winning. This talent alone requires no math and often I see bad traders get bogged down in math, algorithms and indicators when in reality you your brain does it all for you without even thinking about it. Just look at a chart and watch the patterns appear before your eyes.
@arthurmwai3728
@arthurmwai3728 7 жыл бұрын
Very true. Price action trading is the way to go: watch out for candlestick patterns and make your trade based on a risk:reward ratio with stopLoss and takeProfit
@plexm6060
@plexm6060 6 жыл бұрын
I've seen a team from a top uni using something based on rnn to do this and the project last for a year. Their best effort was around 60%~70% in next day accuracy in first 5 months and 40% or less in the rest months. Overall it was not better than tossing a coin or even worse. Because it was "garbage in garbage out", and no one is able to ( or it is not worth to, compared to other profiting methods) get the genuine features of stocking market. However, there is a company using semantic analysis to read news to get a firm's status and ultimately making a bigger profit. But in this story the determiner is still human.
@amonst4r
@amonst4r 8 жыл бұрын
That's so freaky. I literally just decided to get into stock market prediction yesterday and was having trouble getting started. Perfect timing Siraj. Thank you!!
@amonst4r
@amonst4r 8 жыл бұрын
in fact yesterday, i also wrote a convenient function for downloading stocks from yahoo finance given a range of dates and an interval of time (by days, months, or years). it returns a list of dicts. i used csv.DictReader instead. if anyone's interested in using or tweaking it, i can post it on github.
@SirajRaval
@SirajRaval 8 жыл бұрын
haha, life is stranger than fiction
@deepschoolai
@deepschoolai 8 жыл бұрын
pandas, pd.read_csv would probably make reading the csv alot faster/ easier.
@SirajRaval
@SirajRaval 8 жыл бұрын
tru tru
@pascal6094
@pascal6094 8 жыл бұрын
@The Math Student How do you write this in a program with pandas?
@lucasscoppio4195
@lucasscoppio4195 7 жыл бұрын
df = pd.read_csv(filename) dates = df.index.values price = df['price'].values
@ayush328
@ayush328 7 жыл бұрын
The Math Student how prediction is done for 2018 year?? I mean what are values for input node ??
@fabian8813
@fabian8813 6 жыл бұрын
Cheers for this, I've been looking for "stock market outlook tomorrow" for a while now, and I think this has helped. Have you ever come across - Sanames Stockify Scripophily - (just google it ) ? Ive heard some unbelievable things about it and my friend got excellent results with it.
@ytcio
@ytcio 6 жыл бұрын
It's just regression, not prediction
@scotta8612
@scotta8612 5 жыл бұрын
shhh don't tell the masses
@sescalaster
@sescalaster 5 жыл бұрын
Exactly. Any intro statistics course will tell you regression models help you make predictions for values within the range of your independent variables. Predicting outside this range is extrapolating the model and it has significantly higher risk. I wouldn't necessarily go for it to stack 'dem benjamins.
@scotta8612
@scotta8612 5 жыл бұрын
@@sescalaster nobody gonna be stacking benjamins with a simple regression model with none of the underlying variables taken into account hahaha it's ludicrous
@1HourBule
@1HourBule 5 жыл бұрын
This guy is a poser if you look into his code base o. Github his coding is garbage and most of his stuff is incomplete or doesn't work
@carlosbustos3568
@carlosbustos3568 4 жыл бұрын
@@sescalaster Hey sergio Quick question Im intersted in math & using data to predict the future. Do you think a data analyst is a good carrer choice? Thank you anyone who can give me clarity
@jaeen7665
@jaeen7665 2 жыл бұрын
I know this is an old video, I just wanted to compliment you on your ability to take a very complex topic, and explain it like I'm five. I've heard it said in the past that if you can't Eli 5 a topic then you don't really know it as well as think you do. However, you've displayed that you know this topic very very well. Fantastic job.
@pasanpawan1834
@pasanpawan1834 7 жыл бұрын
Man, you break this down soo much better than other machine learning videos :)
@woolfel
@woolfel 7 жыл бұрын
Having worked in the finance industry, the answer is "no, you can't predict stock prices." The signal to noise ratio makes it so any model you train won't work for long. It's the reason why High Frequency Trading is so dominant today. You don't need to predict the price, if you just skim a few cents per share and execute hundreds of millions of transactions. Before HFT became popular, algorithmic trading made up a few percent of the trading activity. Today HFT is responsible for more than half the activity on the major exchanges. It's neat to use deep learning, but predicting stock prices isn't going to work :)
@ivanmiskovic8927
@ivanmiskovic8927 7 жыл бұрын
Tell that to James Simons ^^
@piziskewl
@piziskewl 7 жыл бұрын
No, you can't @techn0vids. You are missing a very important variable and that is how the market is going to react, that is something you cannot predict and at best you'll be taking a shot in the dark.
@AkoZoom
@AkoZoom 6 жыл бұрын
What's missing there in prediction (which are ground of trading ...) .. is the use of some (yep not so many !) patterns to describe the trends of the trade. Also first exercise is to train WITH the patterns useful to add some corrections to the prediction.
@vanstarr5610
@vanstarr5610 6 жыл бұрын
woolfel as a trader i totally agree with you, predicting pricing is nonsense, your much better off by doing things like making sure your asset allocations are diverse but not spread to thinly, and diversify across asset classes, and strategy, one trade plan or strategy is not the solution for every trade....one must learn to trade in all market conditions...Markets are Dynamic and conditions can change rapidly...anyone who is new to the market and reading this should check out tastytrade.com and get educated in "Options Trading" God luck out there
@shadmansudipto7287
@shadmansudipto7287 6 жыл бұрын
woolfel please read "the market wizards"
@jonstuartjon3
@jonstuartjon3 7 жыл бұрын
Just want to thank you, Siraj. Your videos are amazing...They're changing lives, for sure. Best of luck to you, and thanks again.
@shubhigautam9655
@shubhigautam9655 7 жыл бұрын
Really love your videos! I started watching them last night, and can't stop. Although you're a bit fast, I think it actually helps us focus on the things you say/ catch our own mistakes as we code. Great job Siraj! :) Please keep uploading more videos haha
@vman049
@vman049 8 жыл бұрын
Great video series! Technically, what you said about making predictions and visualizing them is not incorrect, but it would be a good idea to note that the predictions are in-sample. We should really make out-of-sample predictions to evaluate model performance!
@SirajRaval
@SirajRaval 8 жыл бұрын
true, in-sample predictions i'll make a note thanks
@nabiltech1366
@nabiltech1366 4 жыл бұрын
True.Also train sample to check whether model is overfitting or not
@Mosfet510
@Mosfet510 8 жыл бұрын
This is a great channel, just what I was looking for. You have a good way of bringing someone up to speed fast.
@SirajRaval
@SirajRaval 8 жыл бұрын
thanks Scott
@jackeown
@jackeown 8 жыл бұрын
Isn't this just overfitting? at 6:24 you can see that you've trained on the variables dates and prices and then also use them as your testing data...or is there something I'm missing?
@YouTouchinside
@YouTouchinside 8 жыл бұрын
You are absolutely right
@SirajRaval
@SirajRaval 8 жыл бұрын
the graph fits to the training data, i don't plot predicted points but you can print predicted data points to command line using the 2nd helper function.
@jackeown
@jackeown 8 жыл бұрын
Thanks! I don't mean to nitpick, but what is your performance on data points outside of the date range upon which you trained?
@Loserfr
@Loserfr 8 жыл бұрын
Doesn't that depends on the time and resources associated with the training?
@ailabsus
@ailabsus 7 жыл бұрын
Seems like Siraj was trying to apply this model for different set for test and could not, after decided to just overfit. Anyway, find his videos very useful. Thanks, Siraj!
@EdwinDevey
@EdwinDevey 2 жыл бұрын
A great video. Reading the reviews it seems a lot of poeple are missing the point. The value of your output is the enthusiasm and inspirations to seek further knowledge. Those hoping to watch a 6 minute video then make a fortune the following day will always just be dreamers.
@JenPurple2022
@JenPurple2022 4 жыл бұрын
Great appreciation and praise for his enthusiasm and clear presentation Been through the cycles and have a little bit knowledge about the stocks, trading, investment...etc 1) Long term investment is not the short term speculation which most people engage 2) Modeling is useful only to the extend that you have all the needed data (Such as the over the counter trading, falsified data and behind curtain operations like what happened before the 2008 financial crisis) 3) The best time to make the highest return? Unfortunately, the crisis time...
@sriramabhaktahanuma
@sriramabhaktahanuma 7 жыл бұрын
Fantastic Man! You are quick in teaching..like long story short. Subscribed...!!!!
@SirajRaval
@SirajRaval 7 жыл бұрын
thx
@lilunchengsmiles
@lilunchengsmiles 5 жыл бұрын
If this guy can predict stock price, he won’t doing KZbin
@d7eemo270
@d7eemo270 5 жыл бұрын
haha that is so very true xD
@lilunchengsmiles
@lilunchengsmiles 5 жыл бұрын
@@d7eemo270 It is possible to predict asset and also portfolio optimization. but I only trust those who are making living on those predictions, not KZbinrs.
@d7eemo270
@d7eemo270 5 жыл бұрын
But that is totally my opinion :D
@sovereignbrand2253
@sovereignbrand2253 5 жыл бұрын
Spoken like a true ass
5 жыл бұрын
Exactly, the field and title are nontheless interesting but show it works by testing in the real world. It won't since top investment banks, hedge funds and research firms employ the cream of the crop STEM researchers to model statistical arbitrage of stock markets. Also be careful not to fall into the trap of "over-optimisation" whereby you essentially begin "curve-fitting" your model to known historical data. All falls apart when you "walk" the model forward and test out-of-sample data. There must be a balance for the behaviour of your model.
@NicoLoffredo
@NicoLoffredo 7 жыл бұрын
it's not a prediction, it's just a fit!
@Ninja-iq2xt
@Ninja-iq2xt 7 жыл бұрын
I thought these short length videos wont explain much, but am amazed this is as effective as a 20min. video tutorial. you got one more subscriber! ;)
@transam351
@transam351 7 жыл бұрын
You are amazing!!!! Thanks so much for taking the time to do this
@SirajRaval
@SirajRaval 7 жыл бұрын
thanks so much! more to come
@daltonbrady2492
@daltonbrady2492 7 жыл бұрын
Siraj you're so freaking awesome! Thanks for all the wonderful videos you've taught me so much!
@SirajRaval
@SirajRaval 7 жыл бұрын
thanks Dalton
@adamgoyer2077
@adamgoyer2077 6 жыл бұрын
Thanks for putting this together - will continue to follow your work
@hellmutmatheus2626
@hellmutmatheus2626 8 жыл бұрын
My gawd man you are like prometheus that bring light to the mankind
@SirajRaval
@SirajRaval 8 жыл бұрын
LOL thank you
@Eroenjin
@Eroenjin 7 жыл бұрын
I've been in this game for a while and yes, you can create slightly better than random guesses based on historical stock price data alone (I've tested Kalman filters and recurrent neural networks in this case). However, I also analyze news and discussions related to the stock in question and include that data in my model (sentiment analysis is one part of that model). To my experience, the stock market is a very subjective market, i.e. a big portion of valuation is based on the perception of value rather than the actual value.
@bat-amgalanbat-erdene2621
@bat-amgalanbat-erdene2621 7 жыл бұрын
Have you used that to earn money? What is the time interval do you trade in? Below a second, minutes, hours or days?
@juliansoto2651
@juliansoto2651 6 жыл бұрын
...weeks, months, years, decades.
@tamastamas5805
@tamastamas5805 8 жыл бұрын
Wow, you are making complicated so simple!! Thank you!
@SirajRaval
@SirajRaval 8 жыл бұрын
anytime!
@fallout__boy1130
@fallout__boy1130 4 жыл бұрын
**Very wrong way** of doing time series prediction. I am sure a dummy model that predict t+1 being t would give a better R2 score. Things is that with market stock time series, the data is heavily correlated and you need to "de-correlate" (for instance x_t = x_t - x_t-1) before doing any regression work, otherwise your are getting a systemic error, x_t-x_t-1. The whole problem is to predict the variation of the "de-correlated" data set (ie the absolute difference between t and t+1 for instance). At least there is one absolute truth with your model, if you use it to trade you are sure to lose money :)
@robertnewton7263
@robertnewton7263 8 жыл бұрын
You are awesome man! I watched every video and it has motivated me to learn these programs. I might even do a blog about it! Keep it up!
@SirajRaval
@SirajRaval 8 жыл бұрын
Robert thats awesome, if you do a blog definitely send me the link
@riotviou4228
@riotviou4228 7 жыл бұрын
you have a funky channel, I'm definitely subscribing.
@Manuel-dz1iq
@Manuel-dz1iq 6 жыл бұрын
this channel is gold. Thx bro
@faiyaadalam1664
@faiyaadalam1664 8 жыл бұрын
Perfect! You go at a really good pace. Thanks a lot for the knowledge dump.
@SirajRaval
@SirajRaval 8 жыл бұрын
thanks Faiyaad!
@klin1klinom
@klin1klinom 6 жыл бұрын
I suspect accurate market prediction would change it's outcome, making it inaccurate in the end) One would have to consider consequences of selling or buying in anticipation of predicted dive/hike, possibly causing rapid bubble growth with inevitable burst, or just a total crash right away. If anything, guys down at "Wall St." would use tools to manipulate trading, actually shaping the market outcome rather than predicting it. Such software would also have to counter anything unusual, especially if it looks like trade anticipates its own activity (someone or something discovered a pattern)
@adnanqz4974
@adnanqz4974 6 жыл бұрын
Amazing video! Going to use this example in a workshop I'm conducting for business school students this week! Will remember to cite you during the workshop and ask them to check out your channel. Cheers!
@AlgorithmicApostasy
@AlgorithmicApostasy 6 жыл бұрын
Brilliant use of WoWS clip! Bravo
@darylallen2485
@darylallen2485 5 жыл бұрын
Siraj, thanks for bringing this info to the masses!
@KennTollens
@KennTollens 4 жыл бұрын
Also, one cool way to get stock data. symbol = 'MSFT' df = web.DataReader(symbol, data_source='yahoo', start='2012-01-01', end='2020-01-01') data = df.filter(items = ['Open'])
@arthurrichardson1835
@arthurrichardson1835 7 жыл бұрын
Hey, so I tried running this script on my mac and execution starts, but then nothing happens. Tried switching the backend for matplotlib and that didn't help. Any thoughts as to what I'm doing wrong?
@spotflare
@spotflare 5 жыл бұрын
The game of monkey throwing darts, now in python!
@Ezio-Auditore94
@Ezio-Auditore94 4 жыл бұрын
1:50 to 2:07 this is an invaluable addition that makes the whole project easier
@ShakTMT
@ShakTMT 3 жыл бұрын
well im pretty sure you cant do it without installing those things lol, not a case of easy or not
@snpsforyomom
@snpsforyomom 7 жыл бұрын
Siraj you are a python guru!
@SirajRaval
@SirajRaval 7 жыл бұрын
thanks Mark!
@marcussky
@marcussky 8 жыл бұрын
Love your video's, but please read a Finance book because you don't know what stocks are or what Efficient Market Hypothesis is either.
@SirajRaval
@SirajRaval 8 жыл бұрын
lol thanks.
@marcussky
@marcussky 8 жыл бұрын
Sirajology but seriously your video's are the best! They give such a fantastic overview of machine learning has been a huge help to my development. Don't stop!
@ayush328
@ayush328 7 жыл бұрын
Marcus Gawronsky how prediction is done for 2018 year?? I mean what are values for input node ??
@Stingray-ey7hd
@Stingray-ey7hd 7 жыл бұрын
Could you maybe elaborate a bit on what mr. Raval does not know about stocks and EMH?
@fakeapplestore4710
@fakeapplestore4710 6 жыл бұрын
Calm down he went to Columbia
@vedhasp
@vedhasp 8 жыл бұрын
one question... are we not essentially doing the data fitting here, rather than actual prediction? I mean we used the (x,y) data, we still do not know yt for unknown xt from the future yet? Btw thanks for all your videos, you teach things really well!!! To the point, covering most important bits, concise, and making it interesting all the way!!!! Many many thanks!!!
@SirajRaval
@SirajRaval 8 жыл бұрын
thanks a lot! the graph fits the existing data, we can print the predicted price to command line using the helper function. i didn't plot the predicted price good point will do better next time
@blockchainstreet
@blockchainstreet 7 жыл бұрын
I have ever seen, such a great tutorial !!>. You are simply superb.. You turned out the traditional teaching method to be fun & fact based all the time!.. Kudos to you!!... I have one question here, how do we plot the predicted price?
@robinborjesson8499
@robinborjesson8499 6 жыл бұрын
Correct. This is completely worthless for prediction.
@yashwantkolluru8736
@yashwantkolluru8736 6 жыл бұрын
Hey could you tell which helper function could we use to predict the future price? I was trying SVR.predict, but i don't think if it is the right one
@akompsupport
@akompsupport 7 жыл бұрын
OK Folks. Don't try this at home. The code is full of minor misspelling bugs which you will spend hours trying to figure out. Also Google stopped exporting the date value of stock prices in the format this example needs in order to work 'out of the box' so to speak, so you will have to correct for that issue as well. Finally, like all sane persons, if you use python in virtualenv you will need to use the entire directory to tell the program where the csv file is, on linux in my case: get_data('/home/user/Desktop/pystock/aapl.csv').
@trishl707
@trishl707 7 жыл бұрын
I just love this guy.
@SirajRaval
@SirajRaval 7 жыл бұрын
Love back thanks!
@kozmizm
@kozmizm 4 жыл бұрын
So energetic! and so oversimplified. I love your videos, but it's true. Keep up the good work. you teach people the basics, You're not the only click-baiter on younube
@2949peace
@2949peace 6 жыл бұрын
my code is producing a graph that does not pass the vertical line test (basically circles around). any suggestions for fixing this? its driving me crazy
@waqarmehdi4394
@waqarmehdi4394 5 жыл бұрын
Hey Siraj, we don't have to install csv library with pip. It is already installed.
@questforprogramming
@questforprogramming 5 жыл бұрын
This video is of 2016 bro...may be it was like that at that time..!!
@pakodiale6286
@pakodiale6286 5 жыл бұрын
2016 version of Python didn't have it pre-installed
@aleekazmi
@aleekazmi 7 жыл бұрын
Dude why cant all the CS guys be like you. They are always full of themselves and socially awkward af. Big fan :)
@robthorn3910
@robthorn3910 7 жыл бұрын
Something seems wrong but I don't know what. I have a ANN and I fed it GSPC data (Standard and Poors 500) from Jan 2000 to date. The ANN loved it, converged in like 80 iterations, 100%. Ok, I suspect overfitting so I do the cross-validation thing, run the data again for each data vector against the others. Result: 100%. I'm asking it to predict one of five categories, down moderately, down a little, flat, up a little or up moderately. I simply do not believe 100% accuracy is possible but IDK what I'm doing wrong.
@NishaThomp93
@NishaThomp93 7 жыл бұрын
Does csv file reader still work? My terminal keeps getting stuck on not having a mod named csvFileReader. I went into the folder all I have is csv.py in there. I tried trying just csv in place of cfr but I'm still getting errors.
@radhekrishanrathod9001
@radhekrishanrathod9001 5 жыл бұрын
Everytime I have to pause video and read meme.
@najibcasa2745
@najibcasa2745 5 жыл бұрын
This was great, thanks, I been tryin to find out about "stock prices history nyse" for a while now, and I think this has helped. Ever heard of - Fenason Zeyames Idea - (search on google ) ? Ive heard some interesting things about it and my friend got amazing success with it.
@faizahmed8690
@faizahmed8690 7 жыл бұрын
You can use pandas for simplifying the CSV reading process
@techiegeekk7565
@techiegeekk7565 7 жыл бұрын
Do you know how to implement it for years of dataset instead of just 30 days?
@faizahmed8690
@faizahmed8690 7 жыл бұрын
How big is your dataset?
@faizahmed8690
@faizahmed8690 7 жыл бұрын
If it is very huge you can use chunk by chunk import using pandas
@techiegeekk7565
@techiegeekk7565 7 жыл бұрын
As in the above video, the dataset downloaded was for only a month...I want to implement it for data of 5 years.
@williamdixon3135
@williamdixon3135 5 жыл бұрын
I loved the wolf's reference LMAO
@Sagricon
@Sagricon 7 жыл бұрын
If you are trying it with python 3.6 on windows probably need to change your imports 1. csv is already there no need to import it 2. use numpy+mkl from lfd.uci.edu instead of numpy 3. have to install scipy to make skikit-learn to work also available on above site. 4. matplotlib is fine. other surprise is that google finance is no longer provide link to download the historic prices however you can type the url in address bar to access the historic data www.google.com/finance/historical?q=aapl happy coding :)
@blockchainstreet
@blockchainstreet 7 жыл бұрын
I have ever seen, such a great tutorial !!>. You are simply superb.. You turned out the traditional teaching method to be fun & fact based all the time!.. Kudos to you!!... I have one question here, how do we plot the predicted price?
@keerthineeraj7937
@keerthineeraj7937 2 жыл бұрын
exactly. ive the same doubt
@sidaliu8989
@sidaliu8989 7 жыл бұрын
Great try. I think these linear regression models are valuable and better than MA(Moving Average) Models which are widely used in daily life. But the cost of calculation is much more than MA.
@Shaniloka369
@Shaniloka369 7 жыл бұрын
I can't believe all this is coming out of his head. So smart. Ugh
@nidavis
@nidavis 8 жыл бұрын
The price of the stock is not tied to the profits of a company -- it's an open market where it's worth whatever a buyer is willing to pay. Profit might be an input but it's only one of many.
@SirajRaval
@SirajRaval 8 жыл бұрын
it is one of many inputs yup
@rverm1000
@rverm1000 2 жыл бұрын
i couldn't get it to display the graph. don't have any errors. video might be outdated now. or it may be the data csv file.?
@octocat7949
@octocat7949 7 жыл бұрын
In real life chaos, Apple could not even exist by tomorrow, but awesome topic =)
@SirajRaval
@SirajRaval 7 жыл бұрын
lol tomorrow will always exist as long we're around.
@octocat7949
@octocat7949 7 жыл бұрын
Yep, it also could exist without Apple. (Don't forget about factors, that affect stocks. One cannot simply predict a result without all necessary data, but you could have very precise expectations, which is better than nothing)
@LearnToMaster
@LearnToMaster 6 жыл бұрын
Great tutorial. Had to comment out the poly model as it just hung there. I noticed with a larger data set of 365 days, it took about 10x longer to show the graph compared with the 30 days in this tutorial, but the predict function for predicting on the 366 day for example, never worked. Why? Is it just too much processing for my humble mac?
@mihirpota415
@mihirpota415 7 жыл бұрын
Awesome dude...great work
@brandenray9587
@brandenray9587 4 жыл бұрын
This is literally regression toward the mean.
@sirellyn4391
@sirellyn4391 6 жыл бұрын
I tried running dow jones data and it only comes up with a graph with 2 lines. Green and Blue. The blue line goes down diagonally, and the green line is across the bottom. No curves or deviation. Used data from 2015 to 2018. The actual numbers seem to fluctuate fine. Any ideas?
@ysites
@ysites 6 жыл бұрын
Where can we get the file with the data (the .csv file)? Because in GitHub the link points to wikipedia for support Vector Machine.
@Intelligent_foresee
@Intelligent_foresee 7 жыл бұрын
Apparently it can be predicted, by using progressive A.I. However, currently it's only merchandises and currency exchange rate
@FloreVEVO
@FloreVEVO 8 жыл бұрын
Interesting video, like always.
@SirajRaval
@SirajRaval 8 жыл бұрын
thanks Floretta!
@scottphillpott8709
@scottphillpott8709 7 жыл бұрын
I think my program is running but... as you point out the graphs are not plotting. Trying to fix that. What module do you recommend python 3.4?
@SirajRaval
@SirajRaval 7 жыл бұрын
tkAgg
@_mantejkaur
@_mantejkaur 5 жыл бұрын
Hey Siraj ! I am getting an ValueError : couldn't convert string to float : '21/03/2014' When I am trying to put date as an parameter. Please help me out.
@alteralec
@alteralec 7 жыл бұрын
Nice simple example. A bit simplistic though. Suggestions: Using dates to predict stock price is clearly overfitting, add lagged features. Also, why not compute some error metric in addition of looking at the graph?
@peavri
@peavri 8 жыл бұрын
@Sirajology With the CSV I got the following message: python -m pip install csv Collecting csv Could not find a version that satisfies the requirement csv (from versions: ) No matching distribution found for csv
@Naminator99
@Naminator99 8 жыл бұрын
csv should come pre installed with any distro of python
@SirajRaval
@SirajRaval 8 жыл бұрын
yea it should come preinstalled don't worry about it
@KIKEROMA1997
@KIKEROMA1997 5 жыл бұрын
Siraj you truly are amazing, but I think with the stock market it is not as simple as you think it is, for example Before the 2008 financial crisis all securities-related with the housing sector have been going up and up and up for almost 70 years , all previous data would have suggested and upwards trend going on forever, but it collapsed in 2008 due to the subprime mortgage crises, so in that regard I am skeptic, and also following the price trend violates one of the most important principles of investing which is don't follow the hype.
@hwapollo9246
@hwapollo9246 8 жыл бұрын
I laughed at the machine learning whisper. So funny. I'm pulling the trigger. Siraj, can you do a Google Hangout with us? Let's change the world.
@SirajRaval
@SirajRaval 8 жыл бұрын
lmao thanks. hmm email me your idea sirajraval1@gmail.com
@keithandrelashley
@keithandrelashley 6 жыл бұрын
I have trouble finding the CSV file on the google finance site. They should information on the stock but no place to click on "historic prices". Is there another way I can access Facebooks csv? I hope Yahoo doesn't have the same problem. :(
@MoncoCarser
@MoncoCarser 7 жыл бұрын
I would approach this investing problem with much more data (there is plenty of good numbers to use). I don´t care what is Apple´s stock price tomorrow (short-term thinking with a small set of companies is purely dangerous) as I want to find companies that appear best for long-term ownership. Thanks for your great videos!
@SirajRaval
@SirajRaval 7 жыл бұрын
thanks new one on this coming this week!
@hemantrakesh5010
@hemantrakesh5010 6 жыл бұрын
I don't get an output for this code. There are no errors as I'm using Sublime text editor to code this.. I have download the spreadsheet as well, but all I get is an empty python.exe window, No graphs. What might be the problem?
@pankajjoshi2310
@pankajjoshi2310 8 жыл бұрын
you are doing a great job. Keep it up.
@SirajRaval
@SirajRaval 8 жыл бұрын
thanks Pankaj!
@BryceChudomelka
@BryceChudomelka 6 жыл бұрын
Siraj, PyCharm doesn't have the library for "import lstm". What alternative library should I be using? theanos_lstm? Thanks for your time.
@donnilchopda2112
@donnilchopda2112 6 жыл бұрын
Lstm is part of keras library..
@tcoe64
@tcoe64 6 жыл бұрын
Hey Siraj! Sorry if this is a stupid question but how did you get the sklearn package to install with Sublime Text's python environment?
@akshayraj4627
@akshayraj4627 6 жыл бұрын
just install from terminal. thats what i did
@richaranderia9506
@richaranderia9506 6 жыл бұрын
can we apply grid search using the scikit learn library to optimally find the values of c,gamma and epsilon? if not which is the best way to find these parameter values without taking the default values??
@rexevan6714
@rexevan6714 7 жыл бұрын
this is like my time series college task
@ashish1149
@ashish1149 7 жыл бұрын
Two class logistics regression and two class neural network can predict stock prices reasonably accurately to make you tons of money. One quick caution don't try to predict price but use classification algorithm. Most important past price data have no role to play. Use fundamental data!
@SirajRaval
@SirajRaval 7 жыл бұрын
thanks
@nanchomolina
@nanchomolina 5 жыл бұрын
Hi everyone, when I ran this line : get_data('AAPL.csv') it shows a error message": NameError: name 'get_data' is not defined" Can Anyone help me. I copied the same code from the video, but that line doesn't work.
@apoorvwatsky
@apoorvwatsky 6 жыл бұрын
that wolf of wall street seen is better than the original one.
@ricardomarquez9348
@ricardomarquez9348 6 жыл бұрын
very good content, you learn a lot
@Naoufal933
@Naoufal933 8 жыл бұрын
I've been watching your videos the whole evening and I have just one thing to say : -The day you'll get 1.000.000 followers I'll be able to say " I was a fan before he was famous" :D good job.
@SirajRaval
@SirajRaval 8 жыл бұрын
thanks!!
@hansmeiser6078
@hansmeiser6078 7 жыл бұрын
I got no ouput, no error message running demo.py on Win7/Anaconda even while trying alternative backends. Any suggestions? I'm so disappointed now...deeply depressed.
@supergamer-nc7hv
@supergamer-nc7hv 4 жыл бұрын
on line 43 I got a bug what is it? predicted)price = .... predicted_price = ..... or something else?
@caueZero
@caueZero 7 жыл бұрын
Thanks for the amazing video.
@rossjpg
@rossjpg 8 жыл бұрын
Pip install CSV = ERROR ???? Why?? "Could not find a version that satisfies the requirement csv (from version : ) Not matching distribution found for csv How can i solve it???
@SirajRaval
@SirajRaval 8 жыл бұрын
glad you fixed it
@synju
@synju 7 жыл бұрын
??? fixed? I can't install it either! :[
@jacklynch704
@jacklynch704 7 жыл бұрын
I have the same issue!!!
@Yan-os3jl
@Yan-os3jl 7 жыл бұрын
Did u get the solution.PLzzzzzzzzzzzz share.
@teunvanwezel2282
@teunvanwezel2282 7 жыл бұрын
Bit late, but the csv module is part of the standard library. You don't have to install it.
@joshsmit779
@joshsmit779 4 жыл бұрын
When you watch his apology video 😂. Like if you get it.
@abdullahmahi4490
@abdullahmahi4490 10 ай бұрын
I like your video. However, I have some questions, so according to your video, you will have a predicted price of over $660 for a certain date. Do you think that's correct? please correct me of I am wrong. I am just learning
@ckyn3t
@ckyn3t 4 жыл бұрын
So much coding within vanilla python, you can easily read csv's and do some ETL on the file in Spark. You can reduce those lines from 6 to 2 with Spark.
@zaksenterprises
@zaksenterprises 8 жыл бұрын
Thanks for this video. I found it to be simple to follow and easy to duplicate. The only question/issue is that you are doing the calculation based on the day and if you do it from the middle of one month to the next the graph loops back. I assume the date can be looked at using month and day or maybe month day and year correct?
@SirajRaval
@SirajRaval 8 жыл бұрын
good point. this is a very simple example and you're right. it can definitely be improved
@mrundefined30
@mrundefined30 7 жыл бұрын
So by doing this you check if the existing prices are predicted correctly, how would you get the new ones? you don't show that in this video, for example: how can you predict the prices for the next day, for each hour or something
@andresfelipeestradarodrigu301
@andresfelipeestradarodrigu301 5 жыл бұрын
How could i make my job without you siraj? JaJAJAJAJAJAJAJJA (Y)
@mohitmalik9763
@mohitmalik9763 6 жыл бұрын
Hey Siraj, have you ever used stock price prediction model to actually trade in stock market, if yes, how much profit/loss you made ?
@stalepalemale
@stalepalemale 5 жыл бұрын
Love your videos Siraj, not only are you damn clever you're funny too! :)
@hiteshvaidya3331
@hiteshvaidya3331 8 жыл бұрын
How did you decide that we must use SVM/SVR, no-free-lunch, rbf and parameters like value of C, gamma etc. ?
@SirajRaval
@SirajRaval 8 жыл бұрын
+Hitesh Vaidya decided to use SVM because its easiest to demo, other points were necessary to explain svm
@SirajRaval
@SirajRaval 8 жыл бұрын
+Hitesh Vaidya decided to use SVM because its easiest to demo, other points were necessary to explain svm
@sebasbros3177
@sebasbros3177 7 жыл бұрын
Traceback (most recent call last): File "stockprice.py", line 42, in get_data('aapl.csv') File "stockprice.py", line 12, in get_data with open(filename, 'r') as csvfile: IOError: [Errno 2] No such file or directory: 'aapl.csv' Help pls i'm stuck : (
Deep Dream in TensorFlow - Learn Python for Data Science #5
7:14
Siraj Raval
Рет қаралды 133 М.
Predict The Stock Market With Machine Learning And Python
35:55
Dataquest
Рет қаралды 708 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 102 МЛН
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 207 МЛН
Solving real world data science tasks with Python Pandas!
1:26:07
Keith Galli
Рет қаралды 1,5 МЛН
Data Scientist vs Data Analyst vs Data Engineer: What's the difference?
6:58
All Machine Learning algorithms explained in 17 min
16:30
Infinite Codes
Рет қаралды 279 М.
Machine Learning for Everybody - Full Course
3:53:53
freeCodeCamp.org
Рет қаралды 7 МЛН
Starting a Career in Data Science (10 Thing I Wish I Knew…)
10:42
Sundas Khalid
Рет қаралды 222 М.
Exploratory Data Analysis with Pandas Python
40:22
Rob Mulla
Рет қаралды 490 М.
How I use Python as a Data Analyst
13:56
Luke Barousse
Рет қаралды 375 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 102 МЛН