ArticleslgStudy

computer science

Alternating decision tree

Alternating decision tree is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Alternating decision tree rather than just read about it. In short: An alternating decision tree (ADTree) is a machine learning method for classification. It generalizes decision trees and has connections to boosting.

Alternating decision tree — main illustration
Alternating decision tree — illustration

Key takeaways

  • Alternating decision tree belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Alternating decision tree to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Alternating decision tree from memory before moving on to harder problems.

Reference excerpt

An alternating decision tree (ADTree) is a machine learning method for classification. It generalizes decision trees and has connections to boosting. An ADTree consists of an alternation of decision nodes, which specify a predicate condition, and prediction nodes, which contain a single number. An instance is classified by an ADTree by following all paths for which all decision nodes are true, and summing any prediction nodes that are traversed.

History ADTrees were introduced by Yoav Freund and Llew Mason. However, the algorithm as presented had several typographical errors. Clarifications and optimizations were later presented by Bernhard Pfahringer, Geoffrey Holmes and Richard Kirkby. Implementations are available in Weka and JBoost.

Motivation Original boosting algorithms typically used either decision stumps or decision trees as weak hypotheses. As an example, boosting decision stumps creates a set of T weighted decision stumps (where T is the number of boosting iterations), which then vote on the final classification according to their weights. Individual decision stumps are weighted according to their ability to classify the data. Boosting a simple learner results in an unstructured set of T hypotheses, making it difficult to infer correlations between attributes. Alternating decision trees introduce structure to the set of hypotheses by requiring that they build off a hypothesis that was produced in an earlier iteration. The resulting set of hypotheses can be visualized in a tree based on the relationship between a hypothesis and its "parent." Another important feature of boosted algorithms is that the data is given a different distribution at each iteration. Instances that are misclassified are given a larger weight while accurately classified instances are given reduced weight.

Alternating decision tree structure An alternating decision tree consists of decision nodes and prediction nodes. Decision nodes specify a predicate condition. Prediction nodes contain a single number. ADTrees always have prediction nodes as both root and leaves. An instance is classified by an ADTree by following all paths for which all decision nodes are true and summing any prediction nodes that are traversed. This is different from binary classification trees such as CART (Classification and regression tree) or C4.5 in which an instance follows only one path through the tree.

Example The following tree was constructed using JBoost on the spambase dataset (available from the UCI Machine Learning Repository). In this example, spam is coded as 1 and regular email is coded as −1.

The following table contains part of the information for a single instance.

The instance is scored by summing all of the prediction nodes through which it passes. In the case of the instance above, the score is calculated as

The final score of 0.657 is positive, so the instance is classified as spam. The magnitude of the value is a measure of confidence in the prediction. The original authors list three potential levels of interpretation for the set of attributes identified by an ADTree:

Individual nodes can be evaluated for their own predictive ability. Sets of nodes on the same path may be interpreted as having a joint effect The tree can be interpreted as a whole. Care must be taken when interpreting individual nodes as the scores reflect a re weighting of the data in each iteration.

Description of the algorithm The inputs to the alternating decision tree algorithm are:

A set of inputs (x1,y1),…,(xm,ym) where xi is a vector of attributes and yi is either -1 or 1. Inputs are also called instances. A set of weights wi corresponding to each instance. The fundamental element of the ADTree algorithm is the rule. A single rule consists of a precondition, a condition, and two scores. A condition is a predicate of the form "attribute <comparison> value." A precondition is simply a logical conjunction of conditions. Evaluation of a rule involves a pair of nested if statements:

1 if (precondition) 2 if (condition) 3 return score_one 4 else 5 return score_two 6 end if 7 else 8 return 0 9 end if

Several auxiliary functions are also required by the algorithm:

W+(c) returns the sum of the weights of all positively labeled examples that satisfy predicate c W−(c) returns the sum of the weights of all negatively labeled examples that satisfy predicate c W(c)=W+(c)+W−(c) returns the sum of the weights of all examples that satisfy predicate c The algorithm is as follows:

1 function ad_tree 2 input Set of m training instances 3 4 wi = 1/m for all i 5 a=12lnW+(true)W−(true) 6 R0 = a rule with scores a and 0, precondition "true" and condition "true." 7 𝒫={true} 8 𝒞= the set of all possible conditions 9 for j=1…T 10 p∈𝒫,c∈𝒞 get values that minimize z=2(W+(p∧c)W−(p∧c)+W+(p∧¬c)W−(p∧¬c))+W(¬p) 11 𝒫+=p∧c+p∧¬c 12 a1=12lnW+(p∧c)+1W−(p∧c)+1 13 a2=12lnW+(p∧¬c)+1W−(p∧¬c)+1 14 Rj = new rule with precondition p, condition c, and weights a1 and a2 15 wi=wie−yiRj(xi) 16 end for 17 return set of Rj

The set 𝒫 grows by two preconditions in each iteration, and it is possible to derive the tree structure of a set of rules by making note of the precondition that is used in each successive rule.

Empirical results Figure 6 in the original paper demonstrates that ADTrees are typically as robust as boosted decision trees and boosted decision stumps. Typically, equivalent accuracy can be achieved with a much simpler tree structure than recursive partitioning algorithms.

References

External links An introduction to Boosting and ADTrees (Has many graphical examples of alternating decision trees in practice). JBoost software implementing ADTrees.

Worked examples

Example 1 — a first encounter with Alternating decision tree

Start with the simplest possible case. Write down what Alternating decision tree claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Alternating decision tree before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Alternating decision tree ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Alternating decision tree

In research
Alternating decision tree appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Alternating decision tree in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Alternating decision tree is common in secondary-school and first-year university syllabi. It links to neighbouring topics Classification algorithms, Decision trees, so understanding it makes those chapters shorter.
In everyday life
Look for Alternating decision tree outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Alternating decision tree” →

How to study Alternating decision tree in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Alternating decision tree means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Alternating decision tree out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Alternating decision tree in simple terms?

An alternating decision tree (ADTree) is a machine learning method for classification. It generalizes decision trees and has connections to boosting.

Why does Alternating decision tree matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Alternating decision tree?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Alternating decision tree.

Tags

  • Classification algorithms
  • Decision trees

Keep exploring