DecisionTreeRegressor predicts numerical targets by repeatedly asking cutoff questions. Each split divides the data, assigns each side its average target, and chooses the cutoff with the lowest mean squared error. section 9.6
Predicting app engagement from age
For eight users, age predicts weekly app-opening days. Testing possible age cutoffs selects 35 because it produces the smallest MSE. Setting max_depth=2 creates splits at 35, 15, and 65, with leaf predictions of 7, 6, 1.33, and 4.5. section 9.6
Table 9.6 A small dataset with eight users, their age, and their engagement with our app. The engagement is measured in the number of days when they opened the app in one week. (view table figure)
| Age |
Engagement |
| 10 |
7 |
| 20 |
5 |
| 30 |
7 |
| 40 |
1 |
| 50 |
2 |
| 60 |
1 |
| 70 |
5 |
| 80 |
4 |
Inspect the eight-user age and engagement dataset used to build the regression tree. section 9.6

