Let's return to our stock market data in applying the two advanced tree models to this dataset. We will run both the random forest and gradient boosted tree algorithms on the data and compare the results, using the same data as we had with the linear regression case.

The predicted lines for the random forest and gradient boosted tree match the data quite well, increasing the number of trees and depth of the trees really increased their performance, especially the gradient boosted model which had struggled when we limited it before.
The mean squared error of the random forest model is 4.65 and the mean squared error of the gradient boosted tree model is 0.05. Comparing this to the linear regression of 89.91, we find the tree models, being able to build more complexity into the model, are able to fit the data much better.