ट्री-आधारित AdaBoost रिग्रेशन
AdaBoost मॉडल आमतौर पर decision trees को base estimators के रूप में उपयोग करते हैं. आइए इसे अभी आज़माते हैं और देखें कि क्या मॉडल का प्रदर्शन और बेहतर होता है.
निष्पक्ष तुलना के लिए हम पहले की तरह बारह estimators ही उपयोग करेंगे. decision tree को अलग से instantiate करने की ज़रूरत नहीं है क्योंकि यह डिफ़ॉल्ट रूप से base estimator होता है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Ensemble Methods
अभ्यास निर्देश
12estimators का उपयोग करकेAdaBoostRegressorबनाइए और fit कीजिए. आपको base estimator बताने की आवश्यकता नहीं है.- टेस्ट सेट पर प्रिडिक्शंस निकालिए.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Build and fit a tree-based AdaBoost regressor
reg_ada = ____(____, random_state=500)
reg_ada.fit(X_train, y_train)
# Calculate the predictions on the test set
pred = ____
# Evaluate the performance using the RMSE
rmse = np.sqrt(mean_squared_error(y_test, pred))
print('RMSE: {:.3f}'.format(rmse))