Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Now that you can create model trees and regression trees and do regular regression, let’s test them to see which one is the best. We’re going to first write a few quick functions to give us a forecast for any given input once we have a tree. Next, we’re going to use this to calculate the test error for three different regression models. We’ll test these models on some data relating a person’s intelligence with the number of speeds on their bicycle.
The data is nonlinear and can’t be easily modeled by a global linear model from chapter 8. Also, the data used in this example is purely fictional.