Understanding Information Gain
Information gain helps choose a useful split in a decision tree. It compares disorder before a split with weighted disorder after that split. The disorder measure is entropy. A pure node has entropy zero. A mixed node has higher entropy. When a candidate attribute creates cleaner child groups, its information gain becomes larger.
What the Inputs Mean
This calculator accepts class totals and branch class counts. You may enter parent totals directly, or let the tool sum the branch rows. Each row represents one value of the tested attribute. For example, a weather attribute can have Sunny, Overcast, and Rain branches. The counts beside each branch show how many records from each class fall there.
How the Result Is Built
The result starts with parent entropy. It then calculates entropy for every branch. Each branch entropy is multiplied by that branch weight. The weighted values are added to form the child entropy. Information gain equals parent entropy minus weighted child entropy. A larger value means the tested attribute removed more uncertainty from the target class.
Gain Ratio and Split Information
Gain ratio is also included. It divides information gain by split information. This helps reduce bias toward attributes with many small branches. Split information becomes larger when an attribute creates many balanced groups. If split information is zero, the ratio is not defined.
Advanced Settings
Use the decimal setting to control display precision. Use the log base option when you need bits, nats, or decimal units. Base two is common for ID3 examples. Optional smoothing can help when a branch contains zero counts. The minimum gain field gives a quick pass or review note.
Practical Review
Check every count before trusting the output. Counts should be nonnegative. Branch totals should match parent totals when a custom parent is used. Small datasets can create unstable choices, so compare several attributes. Information gain is a ranking guide, not a final proof of model quality.
Reporting
This tool is useful for teaching, audit notes, and manual model design. It turns raw class counts into transparent steps. Export the CSV for spreadsheets. Export the PDF for reports, class work, or review files. Keep the example table nearby when preparing your own dataset.
For best decisions, calculate each candidate attribute, compare gains, then inspect practical meaning before selecting a tree split for deployment today.