Skip to main content

What is a decision tree?

The AI Glossary

In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.

A decision tree is a model that reaches a prediction by following a series of questions about the information supplied. Each answer determines the next branch. When the path reaches an endpoint, the model produces a category or a numerical estimate. The diagram resembles a flowchart turned upside down, with one starting point and branches spreading beneath it.

For example, a delivery model might ask whether a parcel is international, whether customs documents are complete and how long it has been in transit. These are input features: characteristics available when the prediction is made. The final branch might estimate the likelihood of a delay.

In a learned decision tree, a training procedure selects questions and thresholds that separate the examples usefully. The tree does not normally search for new questions each time it sees a case. Once fitted, it applies the questions it has learned. A manually written clinical flowchart may look similar, but its rules were selected in a different way.

Trees can handle classification, where the output is a category, and regression, where the output is a number. A terminal branch, often called a leaf, usually bases its prediction on the training cases that reached it.

A small tree can be easy to inspect. A very large one can be difficult to follow and may fit accidental details of the training data. This is overfitting: apparently good development performance that does not carry over to new cases. Limiting the tree’s depth or requiring enough examples in each leaf can help. Combining many trees is another approach, used in methods such as random forests.

After hospital discharge, a decision tree might help predict which patients will need pharmacist support for medication reconciliation. Staff can inspect whether the branches depend on information actually available at discharge. An understandable branch is not necessarily an appropriate clinical rule, however. A split based on insurance type may reflect a copayment barrier rather than clinical complexity. Inspectability makes a rule easier to question; it does not settle whether the rule should determine care.

Sources: scikit-learn — Decision Trees

Further reading from Harvard Chan: Public Health Perspectives — To Meet Future Needs, Health Care Leaders Must Look at the Data (Science) (2022).

To learn more, take a look at the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.


I’m a doctor, not a statistician. I teach the AI in Health Care Certificate of Specialization with Dr. Heather Mattie, a statistician and co-director of Harvard Chan’s Health Data Science master’s program. For more on data science and statistics, see Harvard Chan’s Health Data Science resources.

AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.

For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.

Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy

Lead with AI in Health Care

The AI Pragmatist is a monthly newsletter from ALA faculty, with new explainers & essays from the Advanced Learning Academy