Advertisement
gk231192

Module 9.2 Boosting

Jul 3rd, 2025
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. from sklearn.ensemble import GradientBoostingClassifier
  2.  
  3. # Create Gradient Boosting model
  4. boosting_model = GradientBoostingClassifier(n_estimators=100, random_state=42)
  5.  
  6. # Train the model
  7. boosting_model.fit(X_train, y_train)  # Note: No scaling needed for trees
  8.  
  9. # Predict
  10. y_pred_boosting = boosting_model.predict(X_test)
  11.  
  12. # Evaluate
  13. print("Gradient Boosting")
  14. print("Accuracy:", accuracy_score(y_test, y_pred_boosting))
  15. print(confusion_matrix(y_test, y_pred_boosting))
  16. print(classification_report(y_test, y_pred_boosting))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement