LightGBM description:
GBDT (Gradient Boosting Decision Tree) is a machine learning models enduring, whose main idea is to take advantage of weak classifiers (decision tree) iterative training in order to get the optimal model, which has a good training effect, not easy to over-fitting Etc. GBDT wide application in industry, is often used to predict CTR, search sorting and other tasks. GBDT also a variety of data mining competitions deadly weapon, according to the race a statistical Kaggle more than half of the championship program are GBDT based.
LightGBM (Light Gradient Boosting Machine) is a framework to achieve GBDT algorithm, training efficient support parallel, and has the following advantages:
Faster training speed
lower memory consumption
and better accuracy
distributed support, you can quickly process vast amounts of data
Below, in the data set LightGBM Higgs XGBoost nearly 10 times faster than memory usage XGBoost about 1/6, and also to enhance the accuracy of
MAC appears on the actual following error during installation pip
Error Messages
import lightgbm
File "/opt/venv3/lib/python3.7/site-packages/lightgbm/__init__.py", line 8, in <module>
from .basic import Booster, Dataset
File "/opt/venv3/lib/python3.7/site-packages/lightgbm/basic.py", line 32, in <module>
_LIB = _load_lib()
File "/opt/venv3/lib/python3.7/site-packages/lightgbm/basic.py", line 27, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/venv3/lib/python3.7/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib
Referenced from: /opt/venv3/lib/python3.7/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found
Error Resolution:
brew install cmake
brew install gcc
cd /opt #这个不是固定的,任意地方都行
git clone --recursive https://github.com/Microsoft/LightGBM
cd LightGBM
# 需要确认下自己电脑上的gcc版本
/usr/local/opt/gcc/lib/gcc/
total 0
drwxr-xr-x 47 mafei staff 1.5K 3 8 11:52 **9**
我电脑上gcc版本是9,所以命令是
export CXX=g++-9 CC=gcc-9
mkdir build ; cd build
cmake ..
make -j4
当前的LightGBM目录
pwd
/opt/LightGBM/build
进入python-package,会有一个setup.py文件
cd /opt/LightGBM/python-package
执行
python setup.py install --precompile
完美解决