XGBoost、LightGBM、Catboost對比

本文主要參考Battle of the Boosting Algos: LGB, XGB, Catboost,結果與原文有出入。

1. 對比標準

1.1 數據集

  • 分類Fashion MNIST(60000條數據784個特徵)
  • 迴歸NYC Taxi fares(60000條數據7個特徵)
  • 大規模數據集:NYC Taxi fares(2百萬條數據7個特徵)

PS:本文只進行了分類的對比

1.2 規則

  1. 使用基準模型
  2. 使用相同參數訓練並利用GridSearchCV調參
  3. 比較訓練和預測耗時、預測分數、可解釋性

1.3 版本

xgboost==0.90
lightgbm==2.3.1
catboost==0.21

2. 結果

2.1 準確率

LightGBM>XGBoost>CatBoost
在這裏插入圖片描述

2.2 訓練時間和預測時間

CatBoost<LightGBM<XGBoost
在這裏插入圖片描述
在這裏插入圖片描述

2.3 可解釋性

XGBoost=LightGBM>Catboost

2.3.1 特徵重要性

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

2.3.2 SHAP值

類別 含義
0 T-shirt/top
1 Trouser
2 Pullover
3 Dress
4 Coat
5 Sandal
6 Shirt
7 Sneaker
8 Bag
9 Ankle boot

XGBoost
在這裏插入圖片描述

LightGBM
在這裏插入圖片描述
CatBoost無法開箱即用

2.3.3 可視化二叉樹

XGBoost
在這裏插入圖片描述

LightGBM
在這裏插入圖片描述

CatBoost繪製樹函數

3. 總結

比賽選LightGBM,工業選Catboost

4. 代碼

https://download.csdn.net/download/lly1122334/12171980

參考文獻

  1. Battle of the Boosting Algos: LGB, XGB, Catboost
  2. Battle of the Boosting Algorithms
  3. mlxtend: A library of extension and helper modules for Python’s data analysis and machine learning libraries
  4. shap: A game theoretic approach to explain the output of any machine learning model
  5. http://www.picnet.com.au/blogs/guido/post/2016/09/22/xgboost-windows-x64-binaries-for-download/
  6. Graphviz - Graph Visualization Software Windows Packages
發佈了231 篇原創文章 · 獲贊 76 · 訪問量 14萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章