Let’s Write a Decision Tree Classifier from Scratch: Machine Learning Recipes #8

Hey everyone! Glad to be back! Decision Tree classifiers are intuitive, interpretable, and one of my favorite supervised learning algorithms. In this episode, I’ll walk you through writing a Decision Tree classifier from scratch, in pure Python. I’ll introduce concepts including Decision Tree Learning, Gini Impurity, and Information Gain. Then, we’ll code it all up. Understanding how to accomplish this was helpful to me when I studied Machine Learning for the first time, and I hope it will prove useful to you as well.

You can find the code from this video here:

Hands-On Machine Learning with Scikit-Learn and TensorFlow

Follow Josh on Twitter:

Check out more Machine Learning Recipes here:

Subscribe to the Google Developers:


  1. Arthur Barros says:

    You have no idea how your videos helped me out on my journey on Machine Learning. thanks a lot Josh you are awesome.

  2. bombyouandyou says:

    Very nice! Though i should say as a beginner, if i had never attended a demystifying talk for ML by Setu Chokshi, i would have understood naught of this video. Good try though, Google devs.

  3. Carlos Eduardo Mostajo Saenz says:

    Finally! Specially now that Google is in the process of democratize Machine Learning in Google Cloud

  4. Paramdeep Singh obheroi says:

    Gosh I remember when this series first started, I knew nothing about AI or machine learning and now I’m like full on neural nets and TensorFlow. Gotta admit since I don’t have formal education on ml, I don’t classical models as much I understand neural nets.

  5. Dudley Diaz says:

    Why Impurity is calculated one way on 5:33 and on the code it’s calculated differently? (1-(times the # of possible labels) vs 1-(# of possible labels)**2)?

  6. Sundaresan .N says:

    Took nearly one year for this..how abt next video Josh ?? Should we wait till 2018??. Very good contents..thank you very much..

Comments are closed.