Logistic Regression in Python - Predicting if the stock market is going Up or Down

preview_player
Показать описание
This video is showing how Machine Learning can be used in the stock market. It is showing how a Logistic Regression can help to predict whether the market is going Up or Down. In specific on the S&P 500.
The Logistic Regression is implement in Python using statsmodels. I have also performed this using the sklearn library so if you need any support with that kindly let me know.

Get the Notebook/Source code by becoming a Tier-2 Channel member:

I found this prediction in the book: Introduction to statistical learning with R (ISLR) as I am learning R right now. I can highly recommend this book.

This video is for educational and entertaining purposes. It is no investment advice!

If anything is unclear please drop me a comment. I am happy to help!

#Python #LogisticRegression #MachineLearning #Stockmarket
Рекомендации по теме
Комментарии
Автор

Inflation depreciates idle money. I'm in a privileged position to be able to save almost 65% of our net household income, as I placed it on safer investments. The key for us was not spending beyond our means. If you invest and have other sources of income outside of dividends then you will be able to live off dividends. Got north of $520K in my portfolio as I bought a lot of dividend stocks before, I'm buying more now, and I will buy more when it drops further.

mayacho
Автор

Nice contents all way through. Been watching all.your videos. Very immersive and pleasant to watch. Keep up the good work mate!!!

rajeevmenon
Автор

Howdy! I just found your channel on Youtube, and reallylove what you are doing there! I like how clear and detailed your explanations are and the depth of knowledge you have on Python! Your content really stands out and you've put so much thought into your videos. Since I run a tech education channel as well, I love to see fellow Content Creators sharing, educating, and inspiring a large global audience. I wish you the best of luck on your YouTube Journey, cannot wait to see you succeed!


Cheers :-)

eyvlkoc
Автор

Congrats on your video. I like very much this.

maiconreis
Автор

very very helpful, clear and straightforward explain

jollyguo
Автор

"We're not discussing statistics here, we want to predict the market" - what a guy.

benjamintreitz
Автор

Thanks for this. Nicely done. Wondering, since accuracy is improved by looking at just the nearest-term prior lags, if a comparison of this technique with a Markov analysis would be worth while. Similar data prep (skipping the lags); and the Markov Transition Matrix could be built from the 'Direction' column. So not a heavy lift. Thanks for thinking on this.

rsbenari
Автор

Nice video, and is in sync with the book. It would be nice if you could have shown the matrix against a couple of stocks [may be in next video with scikit learn]. Cheers.

usernamei
Автор

Curse of dimensionality demonstrated..thank you..subscribed

dhirajp
Автор

Nice video, just starting to play with ML. And yeah, the p-values are pretty high. Multicollinearity is a central concern in Logistic Regression. I'm gonna try other ML algorithms less sensitive to multicollinearity, maybe one based on decision trees. Maybe PCA can help too. Thanks!

aaronsarinana
Автор

Hi i am curious about the work you do as i trade myself and back-test indicators manually on historical data to optimize my indicators and build strategies . Do you use these models in live trading scenarios.

roym
Автор

This is similar to sports betting. Taking last three wins between two teams will let you predict the next win most of the times since most teams are not evenly matched. Same with SPY which has been bullish since the beginning of time so predicting that it will go up the next day is pretty easy if you think about it. And people put that into an index fund and make money off of it.

teenspirit
Автор

hi, I am getting a separation error when I run the model, can I somehow share with you my data sheet, would appreciate if you could help me with it.

emmadshahid
Автор

Hi, nice content! Would be nice if you create a github repository for your code - or something similar. Thanks for your effort! Btw. I'm also into ML, python and finance, so if you like to exchange some knowlege, just let me know - (I think the german community is still quite small).

colorful_face
Автор

can you do with sklearn. would be great help

gamersclipsandlifestyle
Автор

Nice video, obviously including lag1 up to lag5 into the regression model is a bad idea usually due to very strong autocorrelation of the time series data.

Binancian
Автор

Hey man where can we get the dataset from? Could you provide a link to it?

yes
Автор

Random guessing is 50% only if your y is balanced (i.e. there is the same number of occurrences of "Up" and "Down" in your data). In your case the frequency of "Up" in your data is most likely 0.5272 which is why you are getting that accuracy for your model... If a simple logistic model would be able to truly achieve a performance better than random on the direction of the S&P500 you would be multi billionaire by now :)

francesco.
Автор

Why is the predicted value compared against 0.5 whereas the actual is compared against 0?

collint
Автор

very interesting example ... but serious question about this pseudo R squered ... I tried many times to increase it to the dreamed level 0.2 - 0.4 ... and without big success ... Even in case of your example I can get not more than 0.15 ... And in my opinion this rule 0.2 - 0.4 is like a wish maybe ... not more ... I don't see necessity in such level... What do you think?

ihorhurnyak