# Visualizing and interpreting decision trees

DevFeed: [Visualizing and interpreting decision trees](<https://devfeed.tech/articles/visualizing-and-interpreting-decision-trees-7375.md>)

Original publisher: [Read original article](<https://blog.tensorflow.org/2023/06/visualizing-and-interpreting-decision.html>)

Author: TensorFlow Blog (noreply@blogger.com)

Published: 2023-06-06T17:00:00Z

Content type: tutorial

Language: en

Sources: [The TensorFlow Blog](<https://devfeed.tech/sources/the-tensorflow-blog.md>)

Topics: [Machine Learning & Artificial Intelligence](<https://devfeed.tech/topics/machine-learning-artificial-intelligence.md>), [Model Development](<https://devfeed.tech/topics/model-development.md>), [Google](<https://devfeed.tech/topics/google.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [google](<https://devfeed.tech/tags/google.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [learn](<https://devfeed.tech/tags/learn.md>), [learning](<https://devfeed.tech/tags/learning.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [model](<https://devfeed.tech/tags/model.md>), [predictions](<https://devfeed.tech/tags/predictions.md>), [tensorflow](<https://devfeed.tech/tags/tensorflow.md>), [tensorflow-decision-forests](<https://devfeed.tech/tags/tensorflow-decision-forests.md>), [training](<https://devfeed.tech/tags/training.md>), [visualization](<https://devfeed.tech/tags/visualization.md>)

## AI overview

A tutorial on visualizing and interpreting decision trees with the dtreeviz library and TensorFlow Decision Forests. It explains how decision trees use feature-based splits and leaf nodes to make regression or classification predictions, then demonstrates how visualization can clarify those predictions and the distribution of training instances.

## Source excerpt

Posted by Terence Parr, Google Decision trees are the fundamental building block of Gradient Boosted Trees and Random Forests, the two most popular machine learning models for tabular data. To learn how decision trees work and how to interpret your models, visualization is essential. TensorFlow recently published a new tutorial that shows how to use dtreeviz, a state-of-the-art visualization library, to visualize and interpret TensorFlow Decision Forest Trees. The dtreeviz library, first released in 2018, is now the most popular visualization library for decision trees. The library is constantly being updated and improved, and there is a large community of users who can provide support and answer questions. There is a helpful YouTube video and article on the design of dtreeviz. Let's demonstrate how to use dtreeviz to interpret decision tree predictions. At a basic level, a decision tree is a machine learning model that learns the relationship between observations and target values by examining and condensing training data into a binary tree. Each leaf in the decision tree is responsible for making a specific prediction. For regression trees, the prediction is a value, such as price. For classifier trees, the prediction is a target category, such as cancer or not-cancer. Any path from the root of the decision tree to a specific leaf predictor passes through a series of (internal) decision nodes. Each decision node compares a single feature's value with a specific split point value learned during training. Making a prediction means walking from the root down the tree, comparing feature values, until we reach a leaf. Consider the following simple decision tree that tries to classify animals based upon two features, the number of legs and the number of eyes. Let's say that our test animal has four legs and two eyes. To classify the test animal, we start at the root of the tree and compare our test animal's number of legs to four. Since the number of legs is equal to fo