End-to-end dummy example of serving the model
In this section, we will create an end-to-end dummy example of serving the two regression models together, and then we will combine their responses by averaging them. The models we will use are the following:
- The RandomForestRegression model
- The AdaBoostRegression model
Let’s describe the process step-by-step:
Note
Please keep in mind that the output may be different in your case from the following steps, as you will train the model with some random data generated using the make_regression function.
- First, let’s create the two models with some dummy data and save the models using pickle. The following code snippet creates the models and saves the trained models:
from sklearn.ensemble import RandomForestRegressor, AdaBoostRegressor
from sklearn.datasets import make_regression
import pickle
X, y = make_regression(n_features=2, random_state=0, shuffle=False, n_samples=20)
model1 = RandomForestRegressor...