Attribute Selection Measures in Data Mining

Su Subhalakshmi Chandran Updated 03 Nov 2026
4 min read

Every decision tree, at every node, has to answer the same question: of all the attributes still available, which one should this split be based on? Attribute Selection Measures (ASMs) are the statistical criteria that answer that question, by scoring how well each candidate attribute separates the data into purer subsets. This lesson works through the three most common measures — entropy, information gain, and the Gini index — with one dataset carried through all three so the numbers can be compared directly.

The Dataset Used Throughout This Lesson

Ten training records record whether a match was played, alongside the day's weather:

Weather = Sunny:    4 records (1 Play=Yes, 3 Play=No)
Weather = Overcast: 3 records (3 Play=Yes, 0 Play=No)
Weather = Rainy:    3 records (2 Play=Yes, 1 Play=No)
Total:              10 records (6 Play=Yes, 4 Play=No)

Entropy: Measuring Impurity

Entropy measures how mixed a set of records is with respect to the target class. A set containing only one class has entropy 0 (completely pure); a set split evenly between two classes has the maximum possible entropy for two classes, 1. The formula for a set D with two classes is:

Entropy(D) = -p(Yes) x log2(p(Yes)) - p(No) x log2(p(No))

Applied to the full dataset before any split (6 Yes, 4 No out of 10):

p(Yes) = 0.6,  log2(0.6) ≈ -0.7370
p(No)  = 0.4,  log2(0.4) ≈ -1.3219

Entropy(D) = -(0.6 x -0.7370) - (0.4 x -1.3219) = 0.4422 + 0.5288 ≈ 0.9710

An entropy of 0.9710 (close to the maximum of 1) confirms what the raw counts already suggest: the dataset is close to evenly split and therefore highly impure before any splitting is done.

Information Gain: Measuring the Value of a Split

Information Gain is simply how much the entropy drops after splitting on a candidate attribute — the entropy before the split, minus the size-weighted average entropy of the resulting subsets:

IG(D, A) = Entropy(D) - sum over each subset Dv of [ (|Dv| / |D|) x Entropy(Dv) ]

First, compute the entropy of each subset produced by splitting on Weather:

Sunny (1 Yes, 3 No out of 4):
  Entropy = -(0.25 x log2(0.25)) - (0.75 x log2(0.75)) = -(0.25 x -2.0) - (0.75 x -0.415) = 0.500 + 0.311 ≈ 0.8113

Overcast (3 Yes, 0 No out of 3):
  Entropy = 0   (a pure subset always has zero entropy)

Rainy (2 Yes, 1 No out of 3):
  Entropy = -(0.667 x log2(0.667)) - (0.333 x log2(0.333)) = -(0.667 x -0.585) - (0.333 x -1.585) = 0.390 + 0.528 ≈ 0.9183

Then combine them, weighted by how large each subset is relative to the full dataset:

Weighted entropy after split = (4/10 x 0.8113) + (3/10 x 0) + (3/10 x 0.9183)
                              = 0.3245 + 0 + 0.2755
                              = 0.6000

Information Gain(Weather) = Entropy(D) - Weighted entropy = 0.9710 - 0.6000 = 0.3710

A gain of 0.3710 bits means splitting on Weather removes a substantial fraction of the original uncertainty — and because information gain is computed the same way for every candidate attribute, the tree-building algorithm simply picks whichever attribute produces the largest gain at each node, which is exactly how C4.5, covered in its own dedicated lesson, decides where to split.

The Gini Index: A Faster Alternative to Entropy

The Gini index measures impurity using a different formula that avoids logarithms entirely, which makes it computationally cheaper — this is the criterion CART-style trees use by default:

Gini(D) = 1 - sum of (p_i)^2 for each class i

Computing it for the same dataset and the same three-way split:

Gini(D) = 1 - (0.6^2 + 0.4^2) = 1 - (0.36 + 0.16) = 1 - 0.52 = 0.48

Gini(Sunny)    = 1 - (0.25^2 + 0.75^2) = 1 - (0.0625 + 0.5625) = 0.375
Gini(Overcast) = 1 - (1.0^2 + 0.0^2)   = 1 - 1.0 = 0            (pure, same as entropy)
Gini(Rainy)    = 1 - (0.667^2 + 0.333^2) = 1 - (0.445 + 0.111) = 0.444

Weighted Gini after split = (4/10 x 0.375) + (3/10 x 0) + (3/10 x 0.444)
                           = 0.150 + 0 + 0.133
                           = 0.283

Gini Gain(Weather) = Gini(D) - Weighted Gini = 0.48 - 0.283 = 0.197

Entropy and Gini agree on the direction of the result here — both show Weather reduces impurity substantially, and both correctly identify Overcast as a perfectly pure subset — but they don't have to agree on which of two candidate attributes is best in every case, because the two formulas weight impurity slightly differently. In practice, Gini's avoidance of logarithms makes it noticeably faster to compute on large datasets with many candidate attributes, which is why it's the default splitting criterion in many implementations even though entropy-based information gain remains the more commonly taught measure.

Where This Fits

These measures are the mechanism inside every decision-tree algorithm covered elsewhere in this series — C4.5 and rule-based classification both depend on choosing the right attribute at each split — and the same overfitting risk that motivates tree pruning, covered in its own dedicated lesson, is precisely the risk of a tree that keeps splitting on attributes with only a marginal information gain, chasing patterns specific to the training data rather than patterns that generalize.

0 Comments

Reviewed before they appear

No comments yet.

Data Mining
Introduction to Data Mining Data Mining Implementation Process Data Mining Architecture Data Mining Techniques KDD: Knowledge Discovery in Databases History of Data Mining Data Mining Tools Data Mining vs Machine Learning Facebook Data Mining Social Media Data Mining Methods Clustering in Data Mining Text Data Mining Bagging vs Boosting Data Mining vs Data Warehousing Social Media Data Mining Data Mining: Bayesian Classifiers Data Mining: World Wide Web Different Types of Clustering Bitcoin Mining and Blockchain Data Mining Orange Data Mining Data Mining vs Big Data Decision Tree Induction Educational Data Mining Data Mining in Healthcare Apriori Algorithm Data Integration in Data Mining Difference Between Data Mining and Text Mining Discretization in Data Mining Redundancy and Correlation in Data Mining Classification of Data Mining Systems Classification Algorithms in Data Mining Data Generalization in Data Mining Classification and Prediction in Data Mining Regression in Data Mining What Is an Outlier in Data Mining Data Cleaning in Data Mining Data Processing in Data Mining Data Mining Task Primitives Web Content Mining, Web Structure Mining, and Web Usage Mini Binning in Data Mining KDD vs. Data Mining Noise in Data Mining BIRCH in Data Mining Stemming in Data Mining Feature Transformation in Data Mining Visual and Audio Data Mining Class Comparison Methods in Data Mining Data Selection in Data Mining Tasks and Functionalities of Data Mining Ubiquitous and Invisible Data Mining Importance of Data Mining Data Quality in Data Mining Mining Frequent Patterns in Data Mining Data Warehouse and OLAP Technology for Data Mining Need for Data Mining Pattern Evaluation Methods in Data Mining Logarithms and Exponents in Complexity Analysis Time Series Clustering What is the C4.5 Algorithm and How Does It Work? Expanding Contractions in Text Mining Cosine Similarity in Data Mining Lazy Learning in Data Mining Neural Networks in Data Mining Building a Text Normalizer Shallow Parsing Data Pipeline Orchestration Big Data vs Small Data Myths of Data Mining Data Reduction in Data Mining Data Mining Models Difference Between Data Mining and Data Science Difference Between Data Mining and Statistics Difference Between Data Mining and Web Mining Difference Between Data Mining and Data Analysis Difference Between Business Intelligence and Data Mining Difference Between Data Mining and Data Visualization Data Mining vs Data Analytics Types of Data Mining Difference Between Data Profiling and Data Mining Predictive Analytics vs Data Mining Difference Between Data Mining and OLAP Descriptive and Predictive Data Mining Difference Between Spatial and Temporal Data Mining Difference Between Classification and Clustering in Data Min Hierarchical Clustering in Data Mining Density-Based Clustering in Data Mining What Is Aggregation in Data Mining?
Ask about this post
AI Ask about this post

Ask questions about Attribute Selection Measures in Data Mining and get answers drawn from it.

Signed-in readers only.