Using the regression tree algorithm for the regressors challenge
In this section, we will see how a regression tree algorithm can be used for the regressors challenge:
- First, we train the model using a regression tree algorithm:
- Once the regression tree model is trained, we use the trained model to predict the values:
y_pred = regressor.predict(X_test)
- Then, we calculate RMSE to quantify the performance of the model:
from sklearn.metrics import mean_squared_error
from math import sqrt
sqrt(mean_squared_error(y_test, y_pred))
We get the following output: