A decision tree is an algorithm for decision making. As a very simple illustration example, consider a passionate golfer (person X). Person X has certain preferences regarding days of the week, weather, and temperature. So, to determine how likely Person X is to be on the golf course, the variables Weekday, Weather, and Temperature serve. In this example, the variable “Weather” can take the values “sun”, “cloudy”, “rain” and “snow”. The variable “Temperature”, on the other hand, takes on continuous numerical values.
In order to be able to make statements about whether person X is on the golf course, it makes sense to observe the behavior of person X more closely over a longer period of time. In this way, the weather, temperature and location (golf course yes or no) of person X can be recorded every day. The decision tree can then be generated from this information.
In the first decision level, the days of the week are considered, followed by the weather. If the weather is sunny, person X is probably on the golf course. If it is raining or snowing, person X will never be on the golf course. The second decision level is consulted if the weather is cloudy. If this is greater than or equal to 20 °C on a cloudy day, person X is likely to be on the golf course.
Of central importance are the recorded input variables (here day of the week, weather and temperature) and the target variable (here golf course yes/no). Decision trees can be generated with a wide variety of variable types. For example, real estate prices can also be estimated using various location factors.