Ensemble Machine Learning Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

In Step 1, we imported the required packages. In Step 2, we separated the feature set and the response variable from our dataset. We split our dataset into training and testing samples in Step 3.

Note that our response variable is continuous in nature. For this reason, we built our regression base learners in Step 4 using linear regression, SVR, and a decision tree. In Step 5, we passed our test dataset to the predict() function to predict our response variable. And finally, in Step 6, we added all of the predictions together and divided them by the number of base learners, which is three in our example.