Visualizing a Decision Tree - Machine Learning Recipes #2

  Рет қаралды 969,428

Google for Developers

Google for Developers

Күн бұрын

Пікірлер
@prashantsaraswat9095
@prashantsaraswat9095 3 жыл бұрын
Thank you so much. I just wanted to wrap my head around what a decision tree is. It was at the edge of my understanding. You brought everything into focus and made it crystal clear.
@sandielee
@sandielee 6 жыл бұрын
for python3 and for the print statement: print (test_target) print(clf.predict(test_data))
@shakirrasheedkhankhattak9052
@shakirrasheedkhankhattak9052 5 жыл бұрын
I just started ML and found it very helpful, great start, great examples, well-organized lectures. I am a beginner in ML and loved it, Some times the motivation to TECH might be boosted if you found a great source of learning.
@kaysoar
@kaysoar 8 жыл бұрын
For the 2 people who are demanding for videos... could you ask in a nicer way? High quality video content requires time, and I doubt making these videos is the only thing he has to do at Google... Cheers.
@deananderson8186
@deananderson8186 6 жыл бұрын
bKaysoar B
@amomasi9909
@amomasi9909 5 жыл бұрын
Thank you! I find it to be quite ungrateful, actually.
@karinetorres5213
@karinetorres5213 4 жыл бұрын
Eu
@dolomikal
@dolomikal 8 жыл бұрын
I love how clear and concise these videos are. I feel like I am learning very efficiently because of the broad perspective and how you're teaching to the problem. I can't wait to get into further detail as well as become familiar with more basic concepts. In my opinion your syntax is fine, anyone can pause the video if they want to google each specific line. For someone with a programming background, low calculus/linear algebra knowledge, and zero ML knowledge, this is the best source on the topic! As others have noted, would LOVE to see the submission pace pickup (only because these are so well done! not complaining here!). Great job!
@pradyumna27
@pradyumna27 8 жыл бұрын
usually I play the videos in 1.25X or 1.5X speed, this series is real exception, and made me realize, there is no 0.75x.
@codecruz
@codecruz 7 жыл бұрын
There is now lol
@no_more_free_nicks
@no_more_free_nicks 7 жыл бұрын
When you press spacebar then the video will stop, this is what I use to write the actual code :)
@harrygaggles1414
@harrygaggles1414 8 жыл бұрын
As a newbie! I appreciate your work, and the training you provide! Excellent
@youlearnchannel5383
@youlearnchannel5383 6 жыл бұрын
Working code in python 3.7 , without the pdf : import numpy as np from sklearn.datasets import load_iris from sklearn import tree iris = load_iris() test_idx = [0,50,100] #training data train_target = np.delete(iris.target, test_idx) train_data = np.delete(iris.data, test_idx, axis=0) #testing data test_target = iris.target[test_idx] test_data = iris.data[test_idx] clf = tree.DecisionTreeClassifier() clf.fit(train_data, train_target) print (test_target) print (clf.predict(test_data)) #viz code # test data print (test_data[1],test_target[1]) print (iris.feature_names,iris.target_names)
@samarpratapsingh9788
@samarpratapsingh9788 4 жыл бұрын
why is their axis=0?
@samarpratapsingh9788
@samarpratapsingh9788 4 жыл бұрын
what is the axis?
@maxodo2943
@maxodo2943 4 жыл бұрын
@@samarpratapsingh9788 the given array (iris.data) is a 2 dimensional array, thus arrays in an array. Example: [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12] ] if you would imagine this as table, each array would represent a line as Table: Col1 Col2 Col3 Col4 Row1: 1 2 3 4 Row2: 5 6 7 8 Row3: 9 10 11 12 "row" means "axis=0" in this context. By this line "np.delete(arrayVar, 1, axis=0)" he deletes the elment of index 1 in arrayVar arrayVar = [ [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12] ] test = np.delete(arrayVar, 1, axis=0) test: [ [1, 2, 3, 4], [9, 10, 11, 12] ]
@Iwillseeyouagainin25years
@Iwillseeyouagainin25years 4 жыл бұрын
Thank you!
@nzube
@nzube 8 жыл бұрын
God... I've been waiting for this all week. I liked it before I clicked. Your courses are just very simple and helpful. more excited about writing machine learning code. please don't make us wait this long again... we are the binge generation... lol... amazing work you are doing keep it up
@MACHINEBUILDER
@MACHINEBUILDER 7 жыл бұрын
Thanks so much! - I''ve been trying to install anaconda and other sklearn packages like that, but I was unsuccessful... earlier today, I tried to create my own classifier without using any imported modules, but I was unsuccessful... and, now, after I'd seen this video with VISUALIZING the decision tree, I've just figured out how to make it!! It worked! It can classify : Apples, Oranges, Bananas, Pineapples, and Watermelons just based on weight(g) and texture(bumpy/smooth)! This video was amazingly helpful!!
@riyadhrahman4453
@riyadhrahman4453 8 жыл бұрын
Been waiting everyday for the new episode
@JBGordon
@JBGordon 8 жыл бұрын
+Riyadh Rahman Thanks! I'm doing my best to get these out every two weeks.
@anthonydalessandro8373
@anthonydalessandro8373 8 жыл бұрын
+Josh Gordon every two weeks?! this is blasphemy
@JerryAsher
@JerryAsher 8 жыл бұрын
+Josh Gordon Are there playlists for the individual series, as in a playlist of the ML videos?
@GoogleDevelopers
@GoogleDevelopers 8 жыл бұрын
+Jerry Asher there sure is! It's pretty small still, but stay tuned for another episode in two weeks!
@GoogleDevelopers
@GoogleDevelopers 8 жыл бұрын
+Jerry Asher Save this one! kzbin.info/www/bejne/qn_EamyGfJ2biJo
@coolkidmcoy
@coolkidmcoy 8 жыл бұрын
This series is so good, thank you , thank you , thank you!
@trisnayanayoenara886
@trisnayanayoenara886 4 жыл бұрын
P8 O
@oOZanlanOo
@oOZanlanOo 3 жыл бұрын
yes
@orcaorka
@orcaorka 8 жыл бұрын
I've studied AI and programmed very similar stuff (ID3 algorithm and neural nets) from scratch in C, and it took me hundreds of lines! Holy sh** I didn't know it could be this easy.
@FsimulatorX
@FsimulatorX 8 жыл бұрын
seriously? in C? Dude I just switched from C to Python because I thought stuff like that would be impossible and if not, VERY complicated.
@orcaorka
@orcaorka 8 жыл бұрын
FsimulatorX it was a course requirement. :) the algorithms are actually pretty simple and easy to understand. but i have to agree, programming it in C is tedious! I remember debugging my code for 6 hours because it kept crashing. turns out i missed a single asterisk and the memory was leaking. :)
@tarek3735
@tarek3735 5 жыл бұрын
if you have worked in depth with c it would be much easier to implement.
@chillenld
@chillenld 8 жыл бұрын
Excellent series! I just turned in my term project for my senior undergrad AI course and I'm looking to continue the work in my spare time without the restrictions of the course and having a more application driven series is extremely valuable. I'm really excited to see the amount of resources available for machine learning, as it's a surprisingly friendly field to get started in and I can't wait to see what problems people can solve just by learning a little python and some basic theory. My pet project right now is AI driven stylistic revision for technical writing.
@Abdullah-mg5zl
@Abdullah-mg5zl 6 жыл бұрын
*quick summary of video:* ====================== - there are *several types of classifiers* , each with their own *pros/cons* - one of the pros of a decision tree classifier is that it is *human readable* ("interpret-able") - let's talk a little bit about terminology used to describe the data that you use to train your classifier - let's assume you want to train your classifier to be able to predict the sex of people based on their height, weight, and bone density - you have a bunch of example data, each example consists of a height, weight, bone density, and the corresponding sex (male or female) - we call the height, weight, and bone density *features* - we call the male/female the *class* or *label* - there are a bunch of free data sets out there that you can use to practice machine learning - a popular one is called the iris data set - the iris data set has a bunch of different flower types, along with their petal width, sepal width, etc - again, the petal width, sepal width, etc would be called *features* while the actual flower type would be called the *label* - scikit-learn has a lot of these common data sets built in - for example, you can use the iris data set by doing *data_set = load_iris()* - data_set.data[0] is a list of the features of the 0-eth example in the data set - data_set.data[1] is a list of the features of the 1-eth example - data_set.target[0] is the label for the 0-eth example - and so on...I think you get it - usually, you splits your data set into two subsets - you use one of the subsets to train your classifier - you use the other subset to test how well your trained classifier predicts - a decent rule of thumb is 2/3 to train and 1/3 to test *key thing to take away from the video:* ================================ Lots of different types of classifiers out there, decision tree is just one of them. One of the pros of a decision tree is that it is human readable. There are a bunch of free data sets that are easily importable in scikit-learn, use them to practice machine learning. Use about 2/3 of your data to train, and the other 1/3 to test. Hope that was helpful!! P.S. thanks so much for these videos, they are so well made!
@DarrelFrancis
@DarrelFrancis 5 жыл бұрын
Very well thought out and easy-to-follow introduction. One suggestion: for people who are not aware of the "print ()" requirement of Python 3, it would be worth pointing it out for viewers in one of the earlier videos. Luckily I was aware, but with this small addition, the whole of the tutorial is easy to follow for someone with experience of any other programming language.
@matheusferesdeoliveira5982
@matheusferesdeoliveira5982 6 жыл бұрын
Hey guys, for those who are using Python 3, the code showed on the video might not work. I made some alterations at the end of the code to generate the graph and it worked. # Import from sklearn.datasets import load_iris import numpy as np from sklearn import tree iris = load_iris() # Showing the data (this part I changed too) print(iris.data[0]) print(iris.target[0]) for i in range(len(iris.target)): print('Example {},\t label {},\t features {}'.format(i , iris.target[i] , iris.data[i])) # Training data test_idx = [0,50,100] train_target = np.delete(iris.target, test_idx) train_data = np.delete(iris.data, test_idx, axis=0) # Testing data test_target = iris.target[test_idx] test_data = iris.data[test_idx] clf = tree.DecisionTreeClassifier() clf.fit(train_data, train_target) print(test_target) print(clf.predict(test_data)) # Exporting the decision tree from sklearn.externals.six import StringIO import pydot dot_data = StringIO() tree.export_graphviz(clf, out_file=dot_data, feature_names=iris.feature_names, class_names=iris.target_names, filled=True, rounded=True, impurity=False) # I used this module (graphviz) to generate the graph import graphviz as gp graph = gp.Source(dot_data.getvalue()) graph.render("iris", view = True)
@yashsingh7810
@yashsingh7810 3 жыл бұрын
sadly the last part doesn't work anymore.
@bostongeorge0
@bostongeorge0 8 жыл бұрын
+ josh gordon: Great video to learn about the basics. Two questions: In the decision tree - why do you ask for petal width twice? Should not you ask about third feature instead? The problem arises once the features arent unique to species. ie. the range of values for one feature is farly similar for two and more species. This is where probabilities and combination of features must be used, I assume. Is decision tree the appropriate type of classifier?
@luisleal4169
@luisleal4169 8 жыл бұрын
At any given node, the three must "ask a question" about only one feature? For example arent there any complex cases where the node asks: feature1 < 5 and feature6= 2 ?
@OttoFazzl
@OttoFazzl 8 жыл бұрын
The way material is presented is very nice and Josh Gordon is very good at explaining. Content itself is very introductory though. Can't wait to get to more advanced topics like deep learning with TensorFlow!
@datascienceandmachinelearn3807
@datascienceandmachinelearn3807 6 жыл бұрын
Hi everyone, The code for Python 3 is already below. Best wishes. import numpy as np from sklearn.datasets import load_iris from sklearn import tree iris = load_iris() test_idx = [0,50,100] # training data train_target = np.delete(iris.target, test_idx) train_data = np.delete(iris.data, test_idx, axis=0) # testing data test_target = iris.target[test_idx] test_data = iris.data[test_idx] clf = tree.DecisionTreeClassifier() clf = clf.fit(train_data, train_target) print(test_target) print(clf.predict(test_data)) from sklearn.externals.six import StringIO import pydotplus dot_data = StringIO() tree.export_graphviz(clf, out_file = dot_data, feature_names = iris.feature_names, class_names = iris.target_names, filled = True, rounded = True, impurity = False) graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) graph.write_pdf("iris.pdf")
@souranumaji4213
@souranumaji4213 7 жыл бұрын
Very Straight Forward and much easier to learn and grasp the materials at a time. please conduct a online video series on machine learning for advanced level. very Impressive technique of teaching. thanks a lot for contribution, SIR.
@micky8331
@micky8331 8 жыл бұрын
the link at the end for visualization : scikit-learn.org/stable/modules/tree.html
@mikemetcalfe1903
@mikemetcalfe1903 7 жыл бұрын
If the features were "what it does" rather than "what it looks like" then would'nt you have the start of a database of how things might be used to solve problems? So for example, having "what an axe does", aka. what it might be used for (eg cut wood), then if I have what a tree does, aka. what it can be used for, (provide wood) then I can match up suggestions for how to chop down a tree?
@vddngddnd4306
@vddngddnd4306 8 жыл бұрын
What an diction, even when i'm not native it's so easy to listen you.
@dan-mg4tc
@dan-mg4tc 7 жыл бұрын
Help: I am having an error from "graph.write_pdf("iris.pdf") saying: "AttributeError: 'list' object has no attribute 'write_pdf'"
@tamiltecheria-9471
@tamiltecheria-9471 6 жыл бұрын
same here also have you fixed it
@Endlessvoidsutidos
@Endlessvoidsutidos 6 жыл бұрын
use graph[0]
@arduinoexplorer5437
@arduinoexplorer5437 6 жыл бұрын
Having same problem
@nielagi5029
@nielagi5029 6 жыл бұрын
same problem here
@HaiderAli-bv3gl
@HaiderAli-bv3gl 6 жыл бұрын
same problm how u solve it??
@ElVerdaderoAbejorro
@ElVerdaderoAbejorro 7 жыл бұрын
I have created a github repo with all of the code for all of the recipes of this series. I've used Python3 for all recipes. I've also updated all of the libraries and have added some things to the code here and there. Check it out: github.com/TheCoinTosser/MachineLearningGoogleSeries
@furrane
@furrane 7 жыл бұрын
You deserve way more likes ! Good commenting of the code =)
@keethyanandpr
@keethyanandpr 7 жыл бұрын
Nice video for easy learning. Just wondering if the for loop should actually loop on total data items than target items (somehow I felt it was 4, but then understood there are as many targets in the dataset as the data items itself). Not a big deal since both amount to 150 ;)
@3wayinternet
@3wayinternet 6 жыл бұрын
This code make error "TypeError: 'numpy.ndarray' object is not callable " But it works good when I rewrite "test_idx" to "test_index" Why is it so?
@uladzislautarsunou5700
@uladzislautarsunou5700 8 жыл бұрын
Hi. In this video we learn from the data by doing "clf.fit(train_data, train_target)" whereas in the previous video we re-set the variable clf. The exact line from the previous video is "clf = clf.fit(features, labels)". I'm using the IDE PyCharm and that caused it to make a warning. Was setting clf = clf.fit a mistake? In either case what is the exact implication of doing that line? To my understanding clf is just an Object so there is no 'real' differences between the two statements but just doing 'clf.fit' as opposed to assigning it seems like a cleaner design. Maybe this was already answered or I am asking this in a poor way but some insight would really be appreciated, thanks!
@ShailendraPaliwal
@ShailendraPaliwal 8 жыл бұрын
+Uladzislau Tarsunou `clf.fit` requires some arguments. Using `clf = clf.fit(train_data, train_target)` is fine although redundant I suppose.
@ShivdhwajPandey
@ShivdhwajPandey 7 жыл бұрын
+josh At 3:48 getting ValueError: Number of labels=3 does not match number of samples=147, seems np delete is messing somewhere, import numpy as np from sklearn.datasets import load_iris from sklearn import tree iris = load_iris() test_idx = [0,50,100] #training data train_target = iris.target[test_idx] train_data = np.delete(iris.data, test_idx, axis=0) print train_data #testing data test_target = iris.target[test_idx] test_data = iris.data[test_idx] clf = tree.DecisionTreeClassifier() clf.fit(train_data, train_target) print test_target
7 жыл бұрын
Thanks for the series! It is the best one so far I have seen!
@manuelarechiga2614
@manuelarechiga2614 7 жыл бұрын
Hello, thanks for the video. I have a doubt, for the features I only can use number or I can use for example text with information like a error code to determine specifics step to solved the error (label), among others features maybe numeric or text. Thanks again.
@FsimulatorX
@FsimulatorX 8 жыл бұрын
My question is who created the tree? Was it pre made by people or did the machine create it first and then people made a visual map/tree of what the machine thinks?
@Rhiever
@Rhiever 8 жыл бұрын
I really enjoy this series! I think it would be beneficial if you presented everything in Jupyter Notebooks and released those notebooks alongside your videos.
@Davey-jones101
@Davey-jones101 6 жыл бұрын
Hello everyone! I know I'm quite late, but if anyone could help it would be wonderful. My problem is at 3:53 , when I need to test the code. This is the error message on line 9: AttributeError: 'function' object has no attribute 'target' Please help, thanks!
@MuammarElKhatib
@MuammarElKhatib 8 жыл бұрын
pydot is not working in python3. :/
@JBGordon
@JBGordon 8 жыл бұрын
I see! I just created a Docker image to help, with all the dependencies setup and installation instructions. This is for Python 2, but it'll let you create the PDF at least. Hope this helps! hub.docker.com/r/jbgordon/recipes/
@MuammarElKhatib
@MuammarElKhatib 8 жыл бұрын
Thanks for the docker image Josh. At the moments I wrote my comment, I ended up installing all requirements in python2. Thanks also for the nice videos. Cheers.
@yedhuk
@yedhuk 8 жыл бұрын
You can use pydotplus instead of pydot, like mentioned here: stackoverflow.com/questions/38176472/graph-write-pdfiris-pdf-attributeerror-list-object-has-no-attribute-writ
@MuammarElKhatib
@MuammarElKhatib 8 жыл бұрын
+Yedhu Krishnan thanks for the information :).
@emadehsan
@emadehsan 8 жыл бұрын
Use conda to install these $ conda install -c anaconda pydot=1.0.28 $ conda install -c anaconda graphviz=2.38.0
@waqqas_the_wicked
@waqqas_the_wicked 8 жыл бұрын
THANK YOU JBGordan! I can't wait till the next episode. Thanks you so much!
@greenfrog7174
@greenfrog7174 5 жыл бұрын
if you using python3 (at 4:23), try graph.render('iris") here is the source code scikit-learn.org/stable/modules/tree.html#tree from sklearn.datasets import load_iris from sklearn import tree import graphviz iris = load_iris() clf = tree.DecisionTreeClassifier() clf.fit(iris.data, iris.target) dot_data = tree.export_graphviz(clf, out_file=None, feature_names=iris.feature_names, class_names=iris.target_names, filled=True, rounded=True, impurity=False) graph = graphviz.Source(dot_data) graph.render("iris")
@jhonsilvaale7784
@jhonsilvaale7784 5 жыл бұрын
Hi! I used Jupyter Notebook from Anaconda (with Python 3), and i used the next code, and it worked!: # Import from sklearn.datasets import load_iris import numpy as np from sklearn import tree iris = load_iris() # Showing the data (this part I changed too) print(iris.data[0]) print(iris.target[0]) for i in range(len(iris.target)): print('Example {},\t label {},\t features {}'.format(i , iris.target[i] , iris.data[i])) # Training data test_idx = [0,50,100] train_target = np.delete(iris.target, test_idx) train_data = np.delete(iris.data, test_idx, axis=0) # Testing data test_target = iris.target[test_idx] test_data = iris.data[test_idx] clf = tree.DecisionTreeClassifier() clf.fit(train_data, train_target) print(test_target) print(clf.predict(test_data)) # Exporting the decision tree from sklearn.externals.six import StringIO import pydot dot_data = StringIO() tree.export_graphviz(clf, out_file=dot_data, feature_names=iris.feature_names, class_names=iris.target_names, filled=True, rounded=True, impurity=False) # I used this module (graphviz) to generate the graph import graphviz as gp graph = gp.Source(dot_data.getvalue()) graph.render("iris", view = True) #Saludos desde Chile!
@M310GL
@M310GL 5 жыл бұрын
También, para exportar el árbol de decisiones se puede seguir el ejemplo dado en la documentación de scikit-learn para no recurrir a pydot ni StringIO: import graphviz dot_data = tree.export_graphviz(clf, out_file=None, feature_names=iris.feature_names, class_names=iris.target_names, filled=True, special_characters=True) graph = graphviz.Source(dot_data) graph.render("iris") #Saludos desde México
@lamaalrweta8350
@lamaalrweta8350 4 жыл бұрын
I have an error "No module named 'sklearn' " can u help me with that?
@wb7891
@wb7891 6 жыл бұрын
Just watched the first Machine Learning Recipies, and halfway through this, I was wondering if this was a good place to start learning how to code. Any recommendations?
@spacefarers6960
@spacefarers6960 6 жыл бұрын
Traceback (most recent call last): File "main.py", line 40, in graph.write_pdf('iris.pdf') AttributeError: 'list' object has no attribute 'write_pdf' Am I the only one seeing that?
@spacefarers6960
@spacefarers6960 6 жыл бұрын
I think I copied the complete code......
@kwakkkkkkable
@kwakkkkkkable 8 жыл бұрын
I'm having trouble opening the pdf. How do I solve this problem: 'open' is not recognized as an internal or external command
@jeremyheminger6882
@jeremyheminger6882 7 жыл бұрын
The script simply exports the file as a *.pdf. You might consider running your python script in a local server environment /var/www/html for example then simply linking to the PDF in your browser. I am running a local server (no GUI and accessing it via shell and browser).
@satishjasthi2500
@satishjasthi2500 8 жыл бұрын
Hey Josh your lectures are amazing please continue the series, I'll be looking forward to learn more about machine learning in future episode...
@sandeepjoshi5266
@sandeepjoshi5266 8 жыл бұрын
If you could do all the programming in a Jupyter notebook, it would look really nice in videos and avoid switching between sublime text and terminal :)
@theacademician_cse
@theacademician_cse 7 жыл бұрын
What types of reaserch work we can carry using tensaflow? I am looking for research fileld. I have completed PhD in clustering.
@oysteinludvigsen
@oysteinludvigsen 8 жыл бұрын
This is exactly what I have been looking for. Thanks a lot! Looking forward to the next episode!
@harelib11
@harelib11 4 жыл бұрын
I keep getting errors when trying the pdf thing
@deboral.fernandes4065
@deboral.fernandes4065 7 жыл бұрын
could not open the pdf in 4:27 ... The CMD showed the message: 'open' is not recognized as an internal or external command, operable program or batch file. Somebody knows what I do?
@deboral.fernandes4065
@deboral.fernandes4065 7 жыл бұрын
The 'open -a preview' command is valid for Mac. For Windows, use only 'start iris.pdf'.
@barryoblarney9294
@barryoblarney9294 8 жыл бұрын
I know you can pause the video, but the code should be left up longer than the slides on what to do in general.
@KiloBee777
@KiloBee777 8 жыл бұрын
So glad you guys are doing these vids. Thanks!
@nkuguy
@nkuguy 8 жыл бұрын
Nice! I can't wait till work is over today so I can go through this.
@syedtabrez
@syedtabrez 8 жыл бұрын
what is test_idx=[0,50,100] are these features of iris or any other values.I could not find these values in wikipedia.If those are values then how the algorithm is getting features based on those values??Little bit confused.
@ahnaf_chowdhury
@ahnaf_chowdhury 8 жыл бұрын
+Josh Gordon Hi Josh! if I set, test_idx = [20, 70, 120] then the output should be [0 1 2] but I get [0 2 2]. Can you explain why?
@DeenAdamx
@DeenAdamx 8 жыл бұрын
How did pydot works ? I'm getting an import error that says 'no module named pydot' . Did i miss something ?
@PlaneTony
@PlaneTony 8 жыл бұрын
+Deen Adam I had a bit of a nightmare with this issue on OS X, I found that using Anaconda with python 2.7 instead of 3.4 solved the problem. This is what Josh is using too in the videos. I hope this helps
@DeenAdamx
@DeenAdamx 8 жыл бұрын
+Tony Yates Well, Thanks i will give it a try.
@Walters954
@Walters954 8 жыл бұрын
+Deen Adam I was able to use pydot-ng for python 2.7
@concohabin1552
@concohabin1552 8 жыл бұрын
+Deen Adam this github page might help nbviewer.jupyter.org/github/habinez/Google-ML-Recipes/tree/master/
@JBGordon
@JBGordon 8 жыл бұрын
Here's a docker image with all the dependencies setup: hub.docker.com/r/jbgordon/recipes/ Hope this helps!
@nikhildhyani365
@nikhildhyani365 8 жыл бұрын
how tree knows what parameter to choose as starting point. Ex how it chose petal width(cm)
@MathWithSatvan
@MathWithSatvan 7 жыл бұрын
Very Interesting ..Thanks for the short and interesting videos. Do you have website with these example codes ?
@Kdrahul96
@Kdrahul96 7 жыл бұрын
first video was at the right pace. This video seems like it ran in 4x speed
@mhbdev
@mhbdev 5 жыл бұрын
That's what I'm talkin about
@sachinfulsunge9977
@sachinfulsunge9977 5 жыл бұрын
@@mhbdev You have an option called as pause on youtube bro this is quality content of ML right here no one clarifies this much so appreciate it please
@mafi8360
@mafi8360 4 жыл бұрын
Just watch it 4 times. Or stop moaning.
@silentofthewind
@silentofthewind 5 жыл бұрын
I'm following along with him in Spyder but the iris.pdf file I'm creating doesn't have any filled colors... can anyone help explain why?
@insain9302
@insain9302 8 жыл бұрын
are there only 2 vids on the playlist? i really wanna follow this.
@MonaJalal
@MonaJalal 8 жыл бұрын
Why do you have axis=0 in training_data = np.delete(iris.data, test_idx, axis=0) ?
@sundarrajn1003
@sundarrajn1003 8 жыл бұрын
i have the same question..
@wanderingeek
@wanderingeek 8 жыл бұрын
From what I understand, axis=0 is the vertical axis. So the rows that are deleted are the rows which are indexed by the values in text_idx vertically. For example, if text_idx = [2,5,7], and axis = 0, the 2nd, 5th and 7th rows would be deleted. Also, if test_idx=[2,5,7], but axis = 1, then the 2nd, 5th and 7th columns are deleted, as axis=1 is the horizontal axis. Hope this helps.
@jaguar_akki
@jaguar_akki 7 жыл бұрын
stackoverflow.com/questions/3877491/deleting-rows-in-numpy-array I think here is best expatiation. hope this helps Thank you
@ンシノ-f2b
@ンシノ-f2b 6 жыл бұрын
All programs have moved but pdf files can not be opened. Is it because it is done in a virtual environment?
@uladzislautarsunou5700
@uladzislautarsunou5700 8 жыл бұрын
Oh and thank you very much for making these videos! Appreciate it.
@rajverma25
@rajverma25 7 жыл бұрын
Lot properties of these data sets don't exist from sklearn package. Do you recommend something updated?
@fazil47
@fazil47 6 жыл бұрын
I'm not getting the coloured graph instead I'm getting a control process error.
@leonhardeuler9839
@leonhardeuler9839 6 жыл бұрын
However, I couldn't find the code for visualization. Where is it?
@carlitosvodka
@carlitosvodka 7 жыл бұрын
NameError Traceback (most recent call last) in () 12 test_data = iris.data[test_idx] 13 ---> 14 clf = tree.DecisionTreeClassifier() 15 clf.fit(train_data, Train_target) NameError: name 'tree' is not defined when did we define the tree?
@JeffWeakley
@JeffWeakley 8 жыл бұрын
Hey Josh, great stuff. I realize it takes awhile to make these. Is there anyway to get notified when a new video comes out???? thanks.
@ironhidesk2024
@ironhidesk2024 7 жыл бұрын
Hi thanks for the videos ! I wanted to know which version of sklearn is being used ?
@kumargerman7624
@kumargerman7624 8 жыл бұрын
Awesome SIR , The Best ML tutorial i found in 2016.... love from India
@codewithmarcin
@codewithmarcin 8 жыл бұрын
As someone that just recently got interested in ML. These sort of videos are fantastic. Really looking forward to the next episode. +Google Developers Just as others have asked, and I know it's probably asking a lot but is there any chance you could release these videos more frequently?
@koushik7604
@koushik7604 8 жыл бұрын
Great tutorial.......lot of things to learn.....waiting for next episode.
@saifululum5994
@saifululum5994 6 жыл бұрын
i have homework from my college about ML exactly Decision Tree fro data iris, but i must create manually model decision tree of data iris, could you explain how about if create model manually(i mean manual with paper)?
@fasiabbu
@fasiabbu 8 жыл бұрын
Hi Josh.. great videos.. however i was trying to setup my environment for Graphics Viz.. trying to import pydot for python3 in spyder editor.. was not successful.. Can i know what environment you have been using?
@JBGordon
@JBGordon 8 жыл бұрын
I think I got lucky on my Mac. I created a Docker image to help folks having trouble: hub.docker.com/r/jbgordon/recipes/
@fasiabbu
@fasiabbu 8 жыл бұрын
Cool thanks josh.. i will try that route..
@davidoh0905
@davidoh0905 8 жыл бұрын
I installed pydot by running "conda install -c anaconda pydot=1.0.28" in my sublime console but when I run the file in terminal it says there is no module called pydot. How do I work around this? please help. thank you!
@tensorstrings
@tensorstrings 8 жыл бұрын
How will the syntax change when running these examples in windows? I'm using the anaconda download with scikit and am getting attribute errors in this example. Particularly, the lines that include '.target' or '.data'. I'm still somewhat novice with python.
@AndiRHermawan
@AndiRHermawan 8 жыл бұрын
any solution for pydot in python3 (3.5.1) ?
@JBGordon
@JBGordon 8 жыл бұрын
Hey - I created a Docker image to help, with all the dependencies setup and installation instructions. This is for Python 2, but it'll let you create the PDF at least. Hope this helps! hub.docker.com/r/jbgordon/recipes/
@AndiRHermawan
@AndiRHermawan 8 жыл бұрын
thank you, that's really help me :)
@martakixd
@martakixd 7 жыл бұрын
Hello! Can you put all the links in the description, it's easier to search than diggind the video. Thank you =)
@shivjitiwari8856
@shivjitiwari8856 4 жыл бұрын
On which screen are you working? Please help me to catch you
@TusharSharmabigdreamer101
@TusharSharmabigdreamer101 7 жыл бұрын
if i have a extreme large feature set and training set, wont the decision tree hog memory and be slow?
@steveoshaughnessy3736
@steveoshaughnessy3736 6 жыл бұрын
Where is the pdf saved? I've got everything working in Jypyter Notebook and Python 3. I just searched my entire C drive and found nothing.
@rajendrachede2430
@rajendrachede2430 6 жыл бұрын
which are the better books to learn machine learning from the scratch
@freef49
@freef49 8 жыл бұрын
This series is fantastic!
@engr.md.shahriarforhad1091
@engr.md.shahriarforhad1091 6 жыл бұрын
I have some errors following: File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "C:/Users/Std User/.spyder-py3/ml3.py", line 17, in test_target=iris.target(test_idx) TypeError: 'numpy.ndarray' object is not callable. How can I solve this prob?
@nkunam
@nkunam 3 жыл бұрын
FileNotFoundError: [WinError 2] "dot" not found in path. I keep getting that error when I try to write the dot object into "iris.pdf". How can I fix this? Please help
@lorhannascimento200
@lorhannascimento200 3 жыл бұрын
Use: >>> from sklearn import tree >>> tree.plot_tree(clf) Or first install graphviz for python in your PC and graphviz for Windows, Mac or Ubuntu. Then: >>> import graphviz >>> dot_data = tree.export_graphviz(clf, out_file=None, feature_names=iris.feature_names, class_names=iris.target_names, filled=True) >>> graph = graphviz.Source(dot_data, format="png") >>> graph
@thebuzz2010
@thebuzz2010 8 жыл бұрын
Can someone explain the purpose behind this line "dot_data = StringIO()"
@petercheney2642
@petercheney2642 6 жыл бұрын
It's a string buffer that can store strings
@hirenrana3741
@hirenrana3741 7 жыл бұрын
here we check only petal width what's about other feature??
@wichofer
@wichofer 8 жыл бұрын
Nice! When will episode 3 be avaliable?
@therinyoung4119
@therinyoung4119 7 жыл бұрын
I can't open the pdf file. I'm getting an error message that says the file is corrupt. I'm using windows 10 64bit.
@IceW4ve
@IceW4ve 8 жыл бұрын
Awesome videos man! Is it possible to provide something like a "cheat sheet" where the most important terms of machine learning are summarized? Would be great! :D
@JBGordon
@JBGordon 8 жыл бұрын
+Roman Bauernfeind Fantastic idea! Yes. I already filmed ep #3, but I will put this in ep #4.
@MrNeuroMind
@MrNeuroMind 5 жыл бұрын
What is the name of the program he is using to write pythoon code in?
@fazil47
@fazil47 6 жыл бұрын
Is there an updated version of this video?
@Fnargl99
@Fnargl99 8 жыл бұрын
the link at @4:17 is not working for me.
@kryptons-galaxy
@kryptons-galaxy 5 жыл бұрын
Unable to create the pdf, despite of all dependencies installed Traceback (most recent call last): File "/home/tbd/PycharmProjects/tensorEnv/MLiris2.py", line 42, in graph.write_pdf("iris.pdf") AttributeError: 'list' object has no attribute 'write_pdf'
@williamrudebusch7850
@williamrudebusch7850 8 жыл бұрын
Wow, JBGordon! Great moves, keep it up, proud of you!
@TzaraDuchamp
@TzaraDuchamp 8 жыл бұрын
Here is my solution to this problem. I rewrote the code: from sklearn.datasets import load_iris from sklearn import tree iris = (load_iris()) clf = (tree.DecisionTreeClassifier()) clf = (clf.fit(iris.data, iris.target)) tree.export_graphviz(clf, out_file='irisTree.dot', feature_names=iris.feature_names, class_names=iris.target_names, filled=True, rounded=True, special_characters=True) This will create an irisTree.dot file in the folder where you saved your .py file. From there you can either open Graphiz and load the .dot or you can open up a terminal and write: "dot -Tpng -O" and then drag in your .dot file. This will create a .png.
@hikmetcancelik
@hikmetcancelik 8 жыл бұрын
instead of opening the terminal you can call it from your script. Simply include "from subprocess import call" at the top of your script and "call(["dot", "-Tpdf", "irisTree.dot", "-o", "irisTree.pdf"])" for the last line.
@yusufhalabi7437
@yusufhalabi7437 7 жыл бұрын
It works!
@andrewmao5747
@andrewmao5747 7 жыл бұрын
Another note: to open the dot file in GraphViz, you should navigate to bin/gvedit.exe
@MonaJalal
@MonaJalal 8 жыл бұрын
Also could you please share the link to github page? It would be great to see the source-code.
@cosmicnikhil
@cosmicnikhil 7 жыл бұрын
Please help I'm getting the following error importerror no module named sklearn.datasets, I have installed anaconda 2.Any help would be greatly appreciated
@zhvng
@zhvng 7 жыл бұрын
What's the syntax for "print" in the for loop?
@shravilpotdar
@shravilpotdar 7 жыл бұрын
+JBGordon ... Please could you tell me from where I can find datasets like this?
What Makes a Good Feature? - Machine Learning Recipes #3
5:41
Google for Developers
Рет қаралды 523 М.
Hello World - Machine Learning Recipes #1
6:53
Google for Developers
Рет қаралды 2,6 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
MarI/O - Machine Learning for Video Games
5:58
SethBling
Рет қаралды 11 МЛН
Building with Gemini 2.0: Native audio output
3:44
Google for Developers
Рет қаралды 41 М.
Writing Our First Classifier - Machine Learning Recipes #5
8:44
Google for Developers
Рет қаралды 360 М.
Intro to Feature Engineering with TensorFlow - Machine Learning Recipes #9
7:38
Google for Developers
Рет қаралды 179 М.
Building with Gemini 2.0: Native image output
3:52
Google for Developers
Рет қаралды 71 М.
Why Your Brain Sabotages Your Goals (and How to Fix It)
11:56
Productive Peter
Рет қаралды 24 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН