# Information Gain Calculator

> Enter the class counts in each child node of a split to get information gain (entropy or Gini), split information and the gain ratio used by C4.5.

Category: Statistics & probability · Applies to: Worldwide · Last updated: 2026-10-29
Interactive calculator: https://calculators.geekmidst.com/calculators/information-gain-calculator

Information gain is how much a split reduces impurity: the parent node’s entropy minus the size-weighted entropy of its children. Larger is a better split.

Also called: Gain ratio calculator, Decision tree split calculator.

## Inputs
- Class counts in each child node (default 2 3
4 0
3 2)
- Impurity measure (options: Entropy (bits), Gini impurity; default entropy)

## Results
- Information gain
- Parent impurity
- Weighted child impurity
- Split information (bits)
- Gain ratio
- Parent class counts

## Formula

```
IG = I(parent) − Σ (n_j ÷ n) I(child_j);  SplitInfo = −Σ (n_j ÷ n) log₂(n_j ÷ n);  GainRatio = IG ÷ SplitInfo
```

Where:
- I: impurity: entropy in bits or Gini
- n_j: items in child j
- n: items in the parent

## Worked example
1. Parent = 9 yes, 5 no: H = 0.940286 bits.
2. Children: H(2,3) = H(3,2) = 0.970951 and H(4,0) = 0, so weighted = 2 × (5/14) × 0.970951 = 0.693536.
3. IG = 0.940286 − 0.693536 = 0.24675; split info = 1.577406, gain ratio = 0.156428.

**Result:** Splitting the classic play-tennis data on Outlook gains 0.247 bits, matching the textbook value of 0.246.

## What the result means

Compare candidate splits on the same parent: the highest gain wins. Gain ratio divides by split information to stop attributes with many distinct values (such as IDs) from looking best.

## Assumptions and limits
- Each item falls in exactly one child node.
- For numeric attributes, you choose the threshold; the calculator scores one split at a time.

## Questions

### Why can information gain mislead?

Splitting on a unique ID gives every child a pure node and maximum gain, yet predicts nothing. Gain ratio corrects for this.

### Is Gini gain the same as information gain?

It is the same idea with Gini impurity in place of entropy, as used by CART.

## Related calculators
- [Shannon Entropy Calculator](https://calculators.geekmidst.com/calculators/entropy-shannon-calculator)
- [Gini Impurity Calculator](https://calculators.geekmidst.com/calculators/gini-impurity-calculator)
- [KL Divergence Calculator](https://calculators.geekmidst.com/calculators/kl-divergence-calculator)

Source: GM¹X CalcVerse — https://calculators.geekmidst.com/calculators/information-gain-calculator
