Citation and evidence

ID3 algorithm

20 min full readUpdated 12 references

This article's verification

Report a problem with this article

Edit article
More

Use this article

Raw MarkdownExplore connections

Improve this page

Revision historyDiscuss this article

Topics

AI HistoryAlgorithmsMachine Learning

Cite this article

The ID3 algorithm is a method for building a decision tree classifier from labelled examples, developed by J. Ross Quinlan, who was at the New South Wales Institute of Technology in Sydney when he published its best-known description.[1] It grows the tree from the root down, and at each node it tests the attribute whose values carry the most information about the class, a quantity now called information gain. Quinlan dates the program to 1979 and gave its standard description in "Induction of Decision Trees", published in the first issue of the journal Machine Learning in 1986.[1] The name is commonly expanded as Iterative Dichotomiser 3.[11] ID3 was succeeded by Quinlan's C4.5 and then by the commercial See5/C5.0 system.[2][5] Its entropy-based split criterion is still offered by later tree software such as scikit-learn, although that library builds CART-style binary trees rather than ID3 trees.[11]

The 1986 paper presented ID3 as one member of a family of programs that Quinlan called TDIDT, for Top-Down Induction of Decision Trees, all of which learn classification rules for expert systems from examples rather than from interviews with specialists.[1] The same paper also proposed the gain ratio criterion, a chi-square test for noisy data, and a scheme for unknown attribute values, which C4.5 later developed further.[1][2]

Tree diagram: root picks the attribute with highest information gain, branches A, B, C lead to subtrees or decisions
An example decision tree generated by the ID3 algorithm, splitting on the attribute with the highest information gain at each node. Original diagram: Acoggins38 SVG version: Ixfd64, via Wikimedia Commons, CC BY-SA 4.0.

History

Origins in concept learning

Quinlan placed ID3 in a line of descent that begins with the Concept Learning System (CLS) of E. B. Hunt and colleagues, described in the 1966 book Experiments in Induction by Hunt, Marin and Stone. CLS built a decision tree that tried to minimize the cost of classifying an object, counting both the cost of measuring attributes and the cost of misclassification, and it chose each test with a fixed-depth lookahead that Quinlan compared to minimax.[1]

ID3 grew out of a challenge set by Donald Michie: decide, from pattern-based features alone, whether a position in the King-Rook versus King-Knight chess endgame is lost for the Knight's side within a fixed number of ply.[1] The 1986 paper cites two earlier accounts of ID3: a 1979 chapter, "Discovering rules by induction from large collections of examples", in the collection Expert Systems in the Micro Electronic Age edited by Michie, and a 1983 chapter, "Learning efficient classification procedures and their application to chess endgames", in Machine Learning: An Artificial Intelligence Approach.[1] According to the 1986 paper, the earliest programs in Quinlan's "ID series" chose attributes with what he called a "seat-of-the-pants evaluation function"; ID3 replaced it with an information-based measure, adopted on a suggestion from Peter Gacs.[1]

The TDIDT family

The 1986 paper drew a family tree of TDIDT systems. Most were derived from ID3 directly or through ACLS:[1]

SystemYear shownRelation to ID3
CLS1963Ancestor; cost-driven lookahead [1]
ID31979Information-based attribute selection [1]
ACLS1981Generalization of ID3 that also accepts integer-valued attributes [1]
Expert-Ease1983Commercial derivative of ACLS [1]
ASSISTANT1984Descendant of ID3 with real-valued attributes, binary tests and medical applications [1]
EX-TRAN1984Commercial derivative of ACLS [1]
RuleMaster1984Commercial derivative of ACLS [1]

Expanded article table

Quinlan wrote that the commercial derivatives did not significantly advance the theory but added user-friendly tools, and that all of them had industrial successes. As one example he cited a letter, quoted in the journal Expert Systems in January 1985, in which Westinghouse Electric's Water Reactor Division credited a fuel-enrichment application built with one of these tools with raising revenue by "more than ten million dollars per annum".[1]

"ID3 - Georgia Tech - Machine Learning", video from Udacity, published February 23, 2015. Watch on YouTube.

How the algorithm works

The induction task

ID3 learns from a training set of objects, each described by a fixed set of attributes. In the 1986 formulation every attribute takes a small set of discrete, mutually exclusive values, and every object belongs to one of two classes, written P and N (positive and negative instances of the concept). Quinlan noted that extending the method to more classes "is not difficult", but also stated that ID3 itself allowed only two classes, a restriction most later systems removed.[1]

If two training objects have identical attribute values but different classes, no tree built from those attributes can separate them, and Quinlan called the attributes "inadequate" for that training set. When the attributes are adequate, many different trees classify the training set correctly. ID3 follows the preference, which Quinlan presented as an application of Occam's razor, for the simplest tree, on the grounds that it is more likely to capture real structure and so to classify unseen objects correctly.[1]

Information-based attribute selection

Finding the smallest correct tree by generating every possible tree is feasible only for small problems, so ID3 builds one tree greedily and, in Quinlan's words, "cannot guarantee that better trees have not been overlooked".[1] For a collection $C$ holding $p$ objects of class P and $n$ of class N, ID3 treats the tree as a source of the message "P" or "N" and measures the expected information needed to produce that message, which is the binary entropy of the class proportions:[1]

I(p,n)=−pp+nlog⁡2pp+n−np+nlog⁡2np+nI(p, n) = -\frac{p}{p+n}\log_2\frac{p}{p+n} - \frac{n}{p+n}\log_2\frac{n}{p+n}

If an attribute $A$ with values $A_1, \ldots, A_v$ is placed at the root, it splits $C$ into subsets $C_1, \ldots, C_v$, where $C_i$ contains $p_i$ objects of class P and $n_i$ of class N. The expected information still required after the test is the weighted average of the subsets' entropies, and the gain is the difference:[1]

E(A)=∑i=1vpi+nip+n I(pi,ni),gain(A)=I(p,n)−E(A)E(A) = \sum_{i=1}^{v}\frac{p_i + n_i}{p + n}\, I(p_i, n_i), \qquad \mathrm{gain}(A) = I(p, n) - E(A)

ID3 computes the gain of every candidate attribute and picks the largest. Because $I(p, n)$ is the same for every attribute, this is equivalent to minimizing $E(A)$. The gain is the mutual information between the attribute and the class, a connection Quinlan pointed to in a footnote.[1]

Building the tree

Tree construction is a divide-and-conquer recursion over a collection $C$:[1][3]

  1. If every object in $C$ belongs to the same class (or $C$ is empty), return a leaf labelled with that class.
  2. Otherwise, choose the attribute $A$ with the highest gain and make it the test at this node, with one branch for each value $A_i$.
  3. Partition $C$ by the value of $A$ and build a subtree for each subset $C_i$ by the same procedure.

As long as some test splits a collection into at least two non-empty parts, each subset is smaller than its parent, so the recursion ends and the resulting tree classifies every training object correctly.[1] A special case arises when no object in $C$ has a particular value of the chosen attribute. ID3 labels the resulting empty leaf "null", so an object reaching it is not classified at all; Quinlan suggested that a better choice would be to label it with the most frequent class in the parent collection.[1] The same behavior survives in teaching implementations: the documentation for Weka's educational Id3 class warns that empty leaves may leave instances unclassified.[8]

Windowing

The full ID3 program wraps tree construction in an iterative outer loop. It picks a random subset of the training set, called the window, and builds a tree that is correct for the window. It then classifies the rest of the training set with that tree; if any objects are misclassified, a selection of them is added to the window and the process repeats.[1] Quinlan reported that this found correct trees within a few iterations for training sets of up to 30,000 objects described by up to 50 attributes, and that it was usually faster than building a tree from the whole set at once. He also cited R. A. O'Keefe's 1983 observation that the loop cannot be guaranteed to converge unless the window is allowed to grow to the whole training set.[1] Utgoff's later analysis separated this complete program from the "basic ID3 tree construction algorithm" embedded in it, which is the procedure most textbooks now call ID3.[3]

Computational cost

At each internal node, ID3 must look at every object in the current collection to count classes for each value of each untested attribute, so the work per node is $O(|C| \cdot |A|)$, where $|A|$ is the number of attributes. Quinlan concluded that the total cost per iteration is proportional to the product of the training set size, the number of attributes and the number of internal nodes, and reported no exponential growth as tasks became larger.[1]

Worked example

The 1986 paper illustrates ID3 with 14 Saturday mornings, each described by four weather attributes and labelled P if the morning was suitable for "some unspecified activity" and N otherwise.[1]

No.OutlookTemperatureHumidityWindyClass
1sunnyhothighfalseN
2sunnyhothightrueN
3overcasthothighfalseP
4rainmildhighfalseP
5raincoolnormalfalseP
6raincoolnormaltrueN
7overcastcoolnormaltrueP
8sunnymildhighfalseN
9sunnycoolnormalfalseP
10rainmildnormalfalseP
11sunnymildnormaltrueP
12overcastmildhightrueP
13overcasthotnormalfalseP
14rainmildhightrueN

Expanded article table

Nine objects are P and five are N, so $I(9, 5) = 0.940$ bits. Splitting on outlook gives a sunny subset with 2 P and 3 N ($I = 0.971$), an overcast subset with 4 P and 0 N ($I = 0$) and a rain subset with 3 P and 2 N ($I = 0.971$). The expected information after the split is $E(\text{outlook}) = \tfrac{5}{14}(0.971) + \tfrac{4}{14}(0) + \tfrac{5}{14}(0.971) = 0.694$ bits, for a gain of 0.246 bits.[1]

AttributeGain (bits)
Outlook0.246
Humidity0.151
Windy0.048
Temperature0.029

Expanded article table

Outlook has the largest gain, so it becomes the root.[1] (Computed to four decimal places from the same data, the outlook and humidity gains are 0.2467 and 0.1518, slightly above the paper's three-decimal figures.) Repeating the procedure on each branch gives the tree that the paper reports as ID3's actual output: overcast mornings are P; sunny mornings are split on humidity (high is N, normal is P); and rainy mornings are split on windy (true is N, false is P).[1] The tree uses three of the four attributes and never tests temperature. Quinlan contrasted it with a larger tree, rooted at temperature, that also fits all 14 examples but is, in his words, suspect as an "explanation" of the data because of its greater complexity.[1]

Noise and unknown values

Noisy data

Real training sets contain errors in attribute values and in class labels. Quinlan identified two problems they cause: noise can make adequate attributes appear inadequate, and it can lead to trees of spurious complexity. In the weather example, corrupting the class of object 3 to N would force the smallest correct tree from 8 nodes to 12.[1]

An irrelevant attribute with random values will still show some apparent information gain, so gain alone cannot tell whether a test is worth making. Quinlan reported that a fixed gain threshold large enough to exclude irrelevant attributes also excluded relevant ones. He instead adopted a chi-square test of independence between the attribute and the class, refusing to test any attribute whose irrelevance could not be rejected at a high confidence level such as 99%, which he found prevented over-complex trees that "fit the noise" without hurting performance on noise-free data. When this test stops growth at a node that still holds both classes, the leaf is assigned the more numerous class rather than a class probability, a choice Quinlan reported to give lower expected error.[1]

Experiments on a chess task with 551 objects and 39 binary attributes showed how errors propagate. At a 5% noise level, the error rate of the resulting tree was 1.3% when noise affected only the most noise-sensitive attribute, 11.9% when it affected all attributes and 2.6% when it affected the class labels.[1] Quinlan also reported that, at higher noise levels, a tree learned from equally noisy data classified noisy objects better than a correct tree learned from clean data, and concluded that removing attribute noise from training data is counter-productive when the same attributes will be noisy in use.[1]

Unknown attribute values

The 1986 paper compared ways of filling in a missing value: a Bayesian estimate used by ASSISTANT, a decision tree trained to predict the missing attribute, and the attribute's most common value. On the 551-object task none was reliable; even the best, the decision-tree method, replaced a single unknown value with a wrong one 19% to 22% of the time for the three most important attributes.[1] Treating "unknown" as an extra attribute value fails differently: Quinlan gave an example in which an attribute's expected information falls from 1 bit to 0.84 bits merely because one of its values is missing, making a less complete attribute look more attractive.[1]

The approach Quinlan recommended distributes objects with unknown values across an attribute's values in proportion to the known frequencies when computing gain, which can only lower the attribute's gain. During classification, an object with an unknown value is sent down every branch with a weight proportional to that branch's frequency, and the weights reaching the leaves are summed per class.[1] He reported that accuracy degraded gradually as the share of unknown values rose, with trees learned when 10% of values were missing still classifying nearly 90% of similarly incomplete objects correctly.[1] C4.5 likewise apportions such cases: where CART uses surrogate tests for missing values, C4.5 divides a case probabilistically among a test's outcomes.[2]

Bias toward many-valued attributes

Ivan Bratko's group in Ljubljana found, in a medical problem, that information gain selected a patient-age attribute with nine value ranges over attributes that specialists judged more relevant, and Kononenko and colleagues suggested in 1984 that the criterion favors attributes with many values.[1] Quinlan confirmed this analytically: splitting one value of an attribute into two never lowers its gain, and an attribute with a unique random value for every object would have maximal gain while carrying no information about the class.[1]

The paper compared two remedies. ASSISTANT required every test to be binary, grouping an attribute's values into a subset and its complement. This removes the bias, but it can make trees harder for experts to read, and an attribute with $v$ values has $2^{v-1} - 1$ possible groupings to evaluate, which Quinlan judged infeasible for an attribute with 20 values.[1] Quinlan's alternative divides the gain by the information produced by learning the attribute's value:

IV(A)=−∑i=1vpi+nip+nlog⁡2pi+nip+n,gain ratio(A)=gain(A)IV(A)IV(A) = -\sum_{i=1}^{v}\frac{p_i + n_i}{p + n}\log_2\frac{p_i + n_i}{p + n}, \qquad \text{gain ratio}(A) = \frac{\mathrm{gain}(A)}{IV(A)}

Because the ratio is undefined when $IV(A)$ is zero and can favor attributes with very small $IV(A)$, the criterion picks the highest ratio only among attributes whose gain is at least average.[1] In the weather example only outlook and humidity qualify; their gain ratios are 0.246 / 1.578 = 0.156 and 0.151 / 1.000 = 0.151, so outlook remains the root but by a much smaller margin.[1] In experiments on the 551-object task with all-binary attributes, the gain ratio produced a 143-node tree against the smallest previously known tree of 175 nodes.[1] Gain ratio later became C4.5's default criterion.[2]

The paper also described how a continuous attribute could be handled with binary threshold tests, by sorting its observed values and trying a threshold between each adjacent pair, an approach used in ASSISTANT; ID3 itself, as described in the paper, works with discrete attributes.[1]

Limitations

The main limitations of ID3, as recorded in the 1986 paper and later work, are:

  • Greedy search. Each split is chosen once and never revisited, so the final tree is not guaranteed to be the simplest correct tree.[1]
  • Discrete attributes. The core algorithm assumes each attribute has a small set of discrete values; numeric attributes need thresholds or other preprocessing.[1][8]
  • Bias in information gain toward attributes with many values, discussed above.[1]
  • Overfitting. The basic procedure keeps splitting until each leaf is pure, which makes it sensitive to noise unless a stopping test such as the chi-square criterion is added.[1]
  • Intelligibility. Quinlan wrote that experts shown such trees for their own domains often recognized little familiar material, and he called this the chief obstacle to using induction to build large expert systems. He pointed to Alen Shapiro's "structured induction", which in one problem replaced a large opaque tree with a hierarchy of nine small trees that each made sense to an expert.[1]
  • Batch learning. ID3 needs the whole training set at once; incorporating a new example means building the tree again, the problem that the incremental variants below addressed.[3]

Successors

Incremental variants: ID4 and ID5R

J. C. Schlimmer and D. Fisher's ID4, presented at the 1986 National Conference on Artificial Intelligence, updated a tree one example at a time by storing class counts for every candidate attribute at each node and replacing a node's test when another attribute's score became better. Paul Utgoff showed in 1989 that ID4 discards the subtrees below a node whenever its test changes, so when no attribute is stably best it can thrash indefinitely; three-variable even parity, presented repeatedly in a fixed order, is never learned.[3] Utgoff's ID5R instead restructures the tree with a "pull-up" operation that brings the desired attribute to the top of a subtree without re-examining the training data, and it is guaranteed to produce the same tree as ID3's basic construction procedure for the same examples, provided ties between equally good attributes are broken the same way.[3]

C4.5

Quinlan's book C4.5: Programs for Machine Learning (Morgan Kaufmann, 1993) described the program that replaced ID3.[2] A summary that Quinlan co-wrote for a 2008 survey describes its main features:[2]

  • gain ratio as the default criterion, with plain information gain still available;
  • numeric attributes handled with binary threshold tests $A \le h$ versus $A > h$, where $h$ is chosen by sorting the cases and trying each split point between successive values;
  • an option to group the values of a discrete attribute into subsets rather than using one branch per value;
  • post-pruning with a pessimistic error estimate based on the upper binomial confidence limit (default confidence 0.25), carried out in one pass from the leaves to the root;
  • probabilistic apportioning of cases with unknown values;
  • an alternative output as ordered "if-then" rulesets, derived from the unpruned tree and simplified by dropping conditions.

A 1996 paper in the Journal of Artificial Intelligence Research added a penalty inspired by minimum description length to tests on continuous attributes and reported that it produced smaller trees with higher predictive accuracy.[4] Quinlan's own website distributes C4.5 Release 8 and states that C4.5 "has been superseded by C5.0".[7] C4.5 was among the ten algorithms identified at the IEEE International Conference on Data Mining in December 2006, through nominations, citation screening and votes, as the most influential in data mining.[2]

See5/C5.0

According to the same survey, C4.5 was superseded in 1997 by a commercial system, See5/C5.0, from RuleQuest Research, the company with which Quinlan is affiliated in that survey.[2][7] Its additions include a variant of boosting, new data types such as dates, "not applicable" values, variable misclassification costs, attribute pre-filtering, unordered rulesets in which all applicable rules vote, and multi-threading.[2] RuleQuest later released the C source code of a single-threaded Linux version, C5.0 Release 2.07, under the GNU General Public License, alongside commercial Windows (See5) and Linux (C5.0) versions; the commercial version is multithreaded.[5][6][12] An R package, C50, wraps that code; version 0.2.0 was published on CRAN on 2025-04-03.[10]

RuleQuest's own comparison of C4.5 Release 8 with the GPL edition of C5.0 on three large datasets reports the following decision-tree results; the figures are the vendor's.[5]

DatasetCasesC4.5 errorC5.0 errorC4.5 leavesC5.0 leavesC4.5 time (s)C5.0 time (s)
Sleep stage scoring105,90827.7%27.0%3,5462,16031
Census income199,5235.0%4.9%26412251
Forest cover type581,0126.1%6.1%10,1699,185624

Expanded article table

The larger gap is in rulesets: on the forest cover data RuleQuest reports that C4.5 took 30,115 seconds and more than 3 GB of memory to build its ruleset, against 170 seconds and under 200 MB for C5.0. With 10-trial boosting, C5.0's tree error on that dataset fell from 6.1% to 3.4%.[5]

Comparison

PropertyID3 (1986 paper)C4.5CART
Split criterionInformation gain [1]Gain ratio by default, or information gain [2]Gini index [2]
Branches per testOne per attribute value [1]Two or more [2]Always two [2]
Numeric attributesNot in the core algorithm [1]Threshold tests [2]Threshold tests [11]
PruningChi-square stopping test [1]Pessimistic error-based post-pruning [2]Cost-complexity pruning with cross-validation [2]
Missing valuesProportional distribution [1]Probabilistic apportioning [2]Surrogate tests [2]
Rule outputNo [1]Rulesets [2]No [11]

Expanded article table

Implementations

The Weka machine learning workbench provides an Id3 class in its "simpleEducationalLearningSchemes" package; its documentation describes an unpruned tree that accepts only nominal attributes and no missing values.[8] Weka's J48 class generates pruned or unpruned C4.5 trees and exposes options such as the pruning confidence (default 0.25), reduced-error pruning and binary splits.[9] scikit-learn does not implement ID3 or C4.5: its documentation states that it uses an optimized version of CART, which builds binary trees, and offers Shannon entropy as one of its split criteria.[11]

Continue reading

More from See also

More to read

Topics:AI HistoryAlgorithmsMachine Learning

References

  1. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10 ^11 ^12 ^13 ^14 ^15 ^16 ^17 ^18 ^19 ^20 ^21 ^22 ^23 ^24 ^25 ^26 ^27 ^28 ^29 ^30 ^31 ^32 ^33 ^34 ^35 ^36 ^37 ^38 ^39 ^40 ^41 ^42 ^43 ^44 ^45 ^46 ^47 ^48 ^49 ^50 ^51 ^52 ^53 ^54 ^55 ^56 ^57 ^58 ^59 ^60J. R. Quinlan. "Induction of Decision Trees". *Machine Learning* 1(1): 81-106, March 1986. doi.org/...BF00116251
  2. ^1 ^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 ^10 ^11 ^12 ^13 ^14 ^15 ^16 ^17 ^18 ^19Xindong Wu, Vipin Kumar, J. Ross Quinlan, Joydeep Ghosh, Qiang Yang, Hiroshi Motoda, Geoffrey J. McLachlan, Angus Ng, Bing Liu, Philip S. Yu, Zhi-Hua Zhou, Michael Steinbach, David J. Hand, Dan Steinberg. "Top 10 algorithms in data mining". *Knowledge and Information Systems* 14(1): 1-37, 2008 (published online 4 December 2007). doi.org/...s10115-007-0114-2
  3. ^1 ^2 ^3 ^4 ^5Paul E. Utgoff. "Incremental Induction of Decision Trees". *Machine Learning* 4: 161-186, 1989. doi.org/...A:1022699900025
  4. ^J. R. Quinlan. "Improved Use of Continuous Attributes in C4.5". *Journal of Artificial Intelligence Research* 4: 77-90, 1996. doi.org/...jair.279
  5. ^1 ^2 ^3 ^4RuleQuest Research. "Is See5/C5.0 Better Than C4.5?". RuleQuest Research. rulequest.com/see5-comparison
  6. ^RuleQuest Research. "Free Downloads". RuleQuest Research, last updated April 2022. rulequest.com/download
  7. ^1 ^2Ross Quinlan. "Ross Quinlan's personal homepage". RuleQuest Research. rulequest.com/Personal
  8. ^1 ^2 ^3Eibe Frank. "Id3" (class documentation, simpleEducationalLearningSchemes package). Weka. weka.sourceforge.io/...Id3
  9. ^Eibe Frank. "J48" (class documentation). Weka. weka.sourceforge.io/...J48
  10. ^Max Kuhn et al. "C50: C5.0 Decision Trees and Rule-Based Models", version 0.2.0. CRAN, 2025-04-03. cran.r-project.org/package=C50
  11. ^1 ^2 ^3 ^4 ^5scikit-learn developers. "1.10. Decision Trees". scikit-learn 1.9.1 documentation. scikit-learn.org/...tree
  12. ^RuleQuest Research. "Information on See5/C5.0". RuleQuest Research, last updated April 2022. rulequest.com/see5-info

Improve this article

Add missing citations, update stale details, or write a clearer explanation. Anyone can edit: changes go live when you publish, and every edit is checked by an editor.

2 revisions · v2 · 4,079 words · full history

Fact-checks are independent of edits: a reviewer re-verifies the article against its sources and stamps the date. How we verify

Research and drafting on this wiki are AI-assisted, under named human editorial standards. How AI is used here

Reviewer note: Independent fact-check before publication on November 18, 2026: 92 claims checked against 18 cited and independent sources; 0 material and 7 minor corrections applied before publication.

Cite this page: AI Wiki. "ID3 algorithm." aiwiki.ai, updated 18 Nov 2026, fact-checked 18 Nov 2026. CC BY 4.0. https://aiwiki.ai/wiki/id3_algorithm

Edit article