Advertisement
gk231192

Module 9.2 Gradient Boosting

Jul 3rd, 2025
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. # 6. Gradient Boosting
  2. # What it does: Builds one model at a time, each one trying to correct the previous one's mistakes.
  3. # Use Case: Customer churn prediction, click-through rate optimization.
  4.  
  5. from sklearn.ensemble import GradientBoostingClassifier
  6.  
  7. gb = GradientBoostingClassifier(n_estimators=100, random_state=42)
  8. gb.fit(X_train, y_train)
  9. y_pred = gb.predict(X_test)
  10.  
  11. print("Gradient Boosting Confusion Matrix:\n", confusion_matrix(y_test, y_pred))
  12. print("\nGradient Boosting Classification Report:\n", classification_report(y_test, y_pred))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement