Book Image

Machine Learning with R - Second Edition

By : Brett Lantz
Book Image

Machine Learning with R - Second Edition

By: Brett Lantz

Overview of this book

Table of Contents (19 chapters)
Machine Learning with R Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding decision trees


Decision tree learners are powerful classifiers, which utilize a tree structure to model the relationships among the features and the potential outcomes. As illustrated in the following figure, this structure earned its name due to the fact that it mirrors how a literal tree begins at a wide trunk, which if followed upward, splits into narrower and narrower branches. In much the same way, a decision tree classifier uses a structure of branching decisions, which channel examples into a final predicted class value.

To better understand how this works in practice, let's consider the following tree, which predicts whether a job offer should be accepted. A job offer to be considered begins at the root node, where it is then passed through decision nodes that require choices to be made based on the attributes of the job. These choices split the data across branches that indicate potential outcomes of a decision, depicted here as yes or no outcomes, though in some cases...