一、安裝
數據挖掘比賽最常用預測、分類模型:LGB、XGB、CatBoost、NGB、ANN等。
1.lightgbm
微軟開源的 lightgbm
越來越流行。
目前比賽數據量越來越大,想要獲得一個比較好的預測精度,同時又要減少內存占用以及提升訓練速度,lightgbm
是一個不錯的選擇,其可達到與 xgboost
相似的預測效果。
pip install lightgbm
2.xgboost
在 lightgbm
出現之前,打比賽的不二選擇,現在由於需要做模型融合 stacking
以提高預測精度,所以也需要使用到 xgboost
。
pip install xgboost
pip install xgboost -i https://pypi.tuna.tsinghua.edu.cn/simple # 指定清華鏡像
第一次直接安裝,因為網絡問題,沒安裝上。
換成國內清華鏡像解決。
3.catboost
pip install catboost -i https://pypi.tuna.tsinghua.edu.cn/simple
安裝 CatBoost
時所安裝的依賴。
Installing collected packages: tenacity, python-da
graphviz, catboost
Attempting uninstall: python-dateutil
Found existing installation: python-dateutil 2
Uninstalling python-dateutil-2.6.1:
Successfully uninstalled python-dateutil-2.6
Attempting uninstall: numpy
Found existing installation: numpy 1.14.0
Uninstalling numpy-1.14.0:
Successfully uninstalled numpy-1.14.0
Attempting uninstall: pandas
Found existing installation: pandas 0.22.0
Uninstalling pandas-0.22.0:
Successfully uninstalled pandas-0.22.0
Successfully installed catboost-1.0.4 graphviz-0.1
plotly-5.6.0 python-dateutil-2.8.2 tenacity-8.0.1
4.ngboost
斯坦福發表的新算法,該算法利用自然梯度將不確定性估計引入到梯度增強中。
pip install ngboost -i https://pypi.tuna.tsinghua.edu.cn/simple
二、加載
import pandas as pd
import lightgbm as lgb
import xgboost as xgb
import catboost as ctb