Scikit Learn Machine Learning Tutorial with Python p. 9

preview_player
Показать описание
In this machine learning tutorial video, we're going to be calculating the difference in percent change performance between the individual stocks and the overall S&P 500 index. We will use this to help us categorize stocks, and their features, as being likely for out-performance, or not.

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

Yo sentdex I heard you like exceptions so I put an exception to the exception so that the exception would no longer be an exception! :)

faneltoamna
Автор

I am aware you mentioned in the video about not arguing about the way of calculating % price change. But this question has bothered from this video to the end of this series, so I have to ask: the method used in the script to calcalute %price change means price/SP500 value change is based on how much they change from the begining year (i.e. year 1), right? So if a stock has already beat the SP500 in year n by 80% (i.e. stock_p_change - sp500_p_change = 80%), the chance of stock_p_change > sp500_p_change in year n+1 is significant even though from year n to n+1 it underperformed (e.g. stock_p_change-sp500_p_change drops to 70% in year n+1, so it would still suggest the stock is a good investment for the future. What's the point to use this strategy to select stock or what details am I missing here? Thanks.

s
Автор

These are amazing. Please make a thousand more.

kahisawheel
Автор

for anyone getting volatile 'difference' lines which don't start from 0, check your TotalDebtEquitymrq.csv file for datetime order. I found that I had to use... "for file in sorted(each_file):". Also, thanks for the video @sentdex! :)

jamesdavidson
Автор

I don't seem to have a reply option to your comment +이재호 The quadcopter got put on the back burner after a bunch of issues kept coming up with it. I still plan to eventually do it. I have two of them now, since one was bound to meet its demise. I definitely want to continue the quad series, but will probably scratch the auto-pilot / stabilization board entirely and do everything with the pis and sensors myself or with the tk1 entirely... which will be messy and probably dangerous for anyone within a 1 mile radius :P  ... hopefully soon.

sentdex
Автор

I give u a like without even see ur video! Because i know how awsome u r.

Thehero
Автор

I was having some issues with your exact code. I am working on Ubuntu and the "os" did not read the files in a sorted manner. So, all the dates were scrambled - leading to difference initializing at random time. Anyways, the solution was to simply add the "sorted" command in the each_file. This works because, thankfully, the name of the html files corresponds to the date and time.
each_file = sorted(os.listdir(each_dir))

NPatel-vksk
Автор

You should have used XPath-like module that parses the HTML for you and then just browse the DOM... that would have saved you alot of trouble...

Otherwise commend you on doing those tutorials.. ;)

TheMraptor
Автор

@sentdex - You could have provided the links to CSV files in your description and started the tutorial with loading the data and doing ML.

AtulKakrana
Автор

Just a quick question why haven't you tried printing out the string that you want to get the float of? This would have saved you a lot of headache. That's the way I deal with problems like this.

mamazu
Автор

Hey sentdex. Thanks again for your videos!! I've been following this set of tutorials and coming to this one i wanted to make sure all the data is legit. Seeking online for the closing stock price for Agilent Technologies Inc. for example on 14/05/2013 resulted in a different number ($31.44 ). So as other stocks in the dataset that fall under the same exception. Any idea why that is? I searched a few different sites and they all resulted in $31.44 for that example..

DjDryIcee
Автор

The solution to the data problem in this video is to use one of the many Python HTML parsing libraries! Doing string matching is a tortured, error-prone approach that is totally unnecessary. There are libraries that allow the programmer to use a jQuery like syntax and thus query for the desired fields.

Since I'm handing out advice: The nested try blocks are also a big no-no. They made it much harder to debug the problem and indicate that there is a design flaw in his code--separate those concerns! Write functions! Obtain and IDE with a debugger and use it.

bb
Автор

There's only pathetic amount of machine learning material up to this point. EXCEPTION: These are just USEFUL as hell.

georgeg
Автор

Hey sentdex,

when i am trying to plot the diagram, I got all the labels as Difference...what could be the reason? Cheers!

deanhu
Автор

Hi guys, I'm having problems with the graphics.
I'm using Matplotlib 3.4.3,
I tried to use 1.5 but it conflicts with other libraries

viniciuscaetano
Автор

is there any way to use machine learning with sql queries ?

khan
Автор

In place of
stock_price = (source.split('<span
stock_price = re.search(r'(\d{1, 8}\.\d{1, 8})', stock_price)
stock_price = float(stock_price.group(1))

I replaced the code with
stock_price = source.split('<span

I got the same stock price, but I got a different graph and the graph seems broken,
Why is that happening?

Thanks in advance.

manitbhusal
Автор

Last part of the video that u could not find the issue . I think that tablehead1 not tabledata1 for the exception that u were incurring in the final journey.

palashjyotiborah
Автор

Hey sentdex, been following this tutorial. I got stuck here for the longest time because our graphs just did not match. I think I might've figured out the issue you were trying to fix towards the end of the video. I feel you don't need to type cast `value` as a float. Doing that made my graph much more detailed. I'm going to link the GIST to the possible fix and the code incase you want to rewind back to this version of the code. 

fabianbuentello
Автор

I think with your problem at the end, you were printing the exception even though you were handling it properly, that's why you got really stumped!

Demodude
welcome to shbcf.ru