Assitan Koné
Dec 6

What's the Gini index for machine learning?

Why does the Gini index is used for?

The Gini index is used for decision trees. Indeed, how do we know how to separate the root node? Well, there are a couple of methods, and the Gini index is a good one. It allows checking if the leaves containing labels are pure or impure.
That's right, the more diverse the leaves are, the higher the Gini index is. Why? Because if, let's say, you want to recommend a product using a decision tree, you want to make sure that the leaves are the most homogeneous possible so that you can be confident in your proposition.

Formula

When we glance, we can think that feature A gives leaves with less diversity, so a better score, because we have 3 purple circles and two red circles. But you know what, let’s be a bit more rigorous.
So to choose which feature we use as the root tree, we calculate the diversity of the leaves.
This is the formula:

Score

Then we compare the mean of each tree and choose the lowest number. Our winner is feature A!
#MachineLearning #TechEducation #AIForBeginners #DeepLearning #DataScience #AI #ArtificialIntelligence

Author

Assitan Koné
Founder @Codistwa
Empty space, drag to resize

SHARE

Write your awesome label here.
Free course

Python for Data Science Quick Start

Learn the fundamentals of Python and how to use popular Data Science libraries.
Free guide

Unlock the World of Machine Learning & Deep Learning with Simple Analogies

Write your awesome label here.
Grasp Complex Concepts with Ease—Download Our Free Guide and Start Your AI/ML Journey Today!
Write your awesome label here.
Free guide

FREE GUIDE: 5 Common Mistakes AI/ML Enthusiasts Make

Write your awesome label here.
Learn how to stop chasing endless tutorials and focus on what really matters: building AI/ML projects that make an impact.
Write your awesome label here.

AI & Data Science Empowerment Circle

A supportive, step-by-step paid community that will help you master data science and AI with confidence AND connect your learning to your passions, culture, and expertise—making complex concepts relatable and actionable.
Write your awesome label here.

Overcome Imposter Syndrome and Build Unshakable Confidence in Just 5 Days

Even If You’re New to Data Science or Still Doubting Your Skills!
Sign up. Be inspired. Code.

Get a FREE Machine Learning Roadmap!

Subscribe to our newsletter to get your gift.

Get tips to teach yourself data science without being overwelmed in your email box. Get secrets to think and act like a Data Scientist on a daily basis. 
Write your awesome label here.
Created with