Exemple #1
0
    xgb_hist_clf_pipeline = xgb.train(params, dtrain, num_boost_round=num_rounds)
    
with Timer() as t_test:
    y_prob_xgb_hist = xgb_hist_clf_pipeline.predict(dtest)


# In[14]:


y_pred_xgb_hist = binarize_prediction(y_prob_xgb_hist)


# In[15]:


report_xgb_hist = classification_metrics_binary(y_test, y_pred_xgb_hist)
report2_xgb_hist = classification_metrics_binary_prob(y_test, y_prob_xgb_hist)
report_xgb_hist.update(report2_xgb_hist)


# In[16]:


results_dict['xgb_hist']={
    'train_time': t_train.interval,
    'test_time': t_test.interval,
    'performance': report_xgb_hist
}


# In[17]:
Exemple #2
0
# In general terms, leaf-wise algorithms are more efficient, they converge much faster than depth-wise. However, it may cause over-fitting when the data is small or there are too many leaves.

# ### Metrics
# We are going to obtain some metrics to evaluate the performance of each of the models.

# ```python
# report_xgb = classification_metrics_binary(y_test, y_pred_xgb)
# report2_xgb = classification_metrics_binary_prob(y_test, y_prob_xgb)
# report_xgb.update(report2_xgb)
# results_dict['xgb']['performance'] = report_xgb
# ```

# In[35]:


report_xgb_hist = classification_metrics_binary(y_test, y_pred_xgb_hist)
report2_xgb_hist = classification_metrics_binary_prob(y_test, y_prob_xgb_hist)
report_xgb_hist.update(report2_xgb_hist)


# In[36]:


results_dict['xgb_hist']['performance'] = report_xgb_hist


# In[37]:


report_lgbm = classification_metrics_binary(y_test, y_pred_lgbm)
report2_lgbm = classification_metrics_binary_prob(y_test, y_prob_lgbm)