[xgboost] XGBoost 설치 및 데모
Tensorflow와 함께 요즘 핫한 xgboost는 ensemble classification을 해주는 플랫폼이다. 기본 베이스로 decision tree를 사용하고 있다. 학습시키는것도 매우 간단하게 몇개의 파라미터만 넣으면 학습이된다. 근데 더 웃긴건 성능이 잘나온다는 거... 요즘 딥러닝도 뜨고 있지만 xgboost도 성능이 좋아서 kaggle같은 competition에서도 많이 사용하니 참고하면 좋을것 같다.
github.com/dmlc/xgboost
xgboost (decision tree)
설치하기
python의 pip로 설치가 가능하다.
설치를 하기 전에 c++ compiler가 필요하기 때문에 설치를 해야 한다.
mac에서는
$ brew install gcc —without-multilib
linux
$ sudo apt-get install build-essential
>> 나 설치하는데 47분 9초 걸림… 완전 장난아니네
이후에 아래와 같이 설치하면 끝,
$ sudo pip install xgboost
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-4RVqJZ/xgboost/
물론 업데이트를 하기 위해서는 github에서 build하는게 좋다.
[참고] https://github.com/dmlc/xgboost/tree/master/python-package
데모를 돌려보자
아주 다양하군
XGBoost python feature walkthrough
* Basic walkthrough of wrappers
* Cutomize loss function, and evaluation metric
* Boosting from existing prediction
* Predicting using first n trees
* Generalized Linear Model
* Cross validation
* Predicting leaf indices
* Sklearn Wrapper
* Sklearn Parallel
* Sklearn access evals result
* Access evals result
* External Memory
$ git clone https://github.com/dmlc/xgboost.git
xgboost/demo/guide-python을 확인하면 된다.
[참고] https://github.com/dmlc/xgboost/tree/master/demo/guide-python