Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. xgb_clf = xgb.XGBClassifier(n_estimators=1000,
  2. learning_rate=0.01,
  3. max_depth=3,
  4. subsample=0.8,
  5. colsample_bytree=1,
  6. gamma=1,
  7. objective='binary:logistic',
  8. scale_pos_weight = 10)
  9.  
  10. y_score_xgb = cross_val_predict(estimator=xgb_clf, X=X, y=y, method='predict_proba', cv=5)
  11.  
  12. plot_calibration_curves(y_true=y, y_prob=y_score_xgb[:,1], n_bins=10)
  13.  
  14. calibrated = CalibratedClassifierCV(xgb_clf, method='sigmoid', cv=5)
  15.  
  16. y_score_xgb_clb = cross_val_predict(estimator=calibrated, X=X, y=y, method='predict_proba', cv=5)
  17.  
  18. plot_calibration_curves(y_true=y, y_prob=y_score_xgb_clb[:,1], n_bins=10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement