Boosting 알고리즘
1. Bagging vs Boosting
2. AdaBoost
3. GBDT
4. XGBoost
5. LightGBM
1. Bagging vs Boosting
앙상블 기법의 종류 : 여러 개의 모델 결과를 합쳐 사용
Variance Bias
2. AdaBoost
가장 기초적인 부스팅 알고리즘
1) 이전 모델의 Error를 기반으로 weight를 계산
2) Exponential Loss function을 이용해 Update
2. AdaBoost
1) Error 계산
2) 가중치 계산
3) Exponential Loss Fucntion을 통해 Update
Y : 실제 결과
h : 예측 결과
W_t : t번째 분류기 가중치
- 단점
높은 weight 존재 시
성능이 크게 떨어짐 , 이상치에 약함
3. Gradient Boosting Decision Tree
Gradient descent가 크게 일어나는 지점으로 탐색
3. Gradient Boosting Decision Tree
특징
1) 실제값 – 예측값 = h 라 하고 h와 유사한 Loss function을 가정
2) 이전까지 학습된 모델 F 에 대해 미분하면 기울기로 표현됨
음의 기울기가 0으로 수렴하도록 탐색
- 장점
좋은 성능, 다양한 Loss fucntion 지원
- 단점
과적합 위험, 느린 속도
Gradient descent가 크게 일어나는 지점으로 탐색
4. XGBoost : 병렬처리와 Tree 알고리즘을 이용해 속도개선
- CART (Classfication And Regression Trees)
1) CART 알고리즘 적용
4. XGBoost
일반적인 트리 CART
분류기준 Entropy, information gain Gini index
분류방식 Field별 값을 기준으로 분할 이진 트리
과적합방지 X O
Leaf Node 데이터 수 조절
최소 변화량 조절
장점 구현 용이 사후 가지치기 가능
Leaf 별 점수할당
단점 Category 속성이 많으면
Tree가 깊어짐,
분기할 Feature 선택에 필요한
계산량 많음
충분한 학습데이터 필요
적을 경우 과적합 유발
- CART (Classfication And Regression Trees)
1) CART 알고리즘 적용
4. XGBoost
𝑂𝑏𝑗 𝜃 = 𝐿𝑜𝑠𝑠 𝜃 + 𝜔(𝜃)
𝜔 𝜃 = 𝛾𝑇 +
1
2
𝛿
𝑗=1
𝑇
𝑤𝑗
2
𝜔 = 𝛾3 +
1
2
𝛿(4 + 0.01 + 1)
- Regularization : L1 , L2 식을 통한 과적합방지
2) 함수에 정규화 식 추가로 과적합 방지
4. XGBoost
- 다양한 Loss function : Taylor 급수를 이용해 다양한 옵션 제공
4) 다양한 Loss function 지원
4. XGBoost
- 주요 Parameter 소개 (Python , Scikit-learn)
+ 파라미터 조절에 따른 불균형데이터 성능 변화
1. General Parameter : 모양
- booster : 모델의 종류 (default = gbtree)
- nthread : 코어 수
- num_feature : feature 수
2. Booster Parameter :
- min_child_weight
: 관측치들 가중치 합의 최소값 (default = 1) -> 1로 고정
- max_delta_step (default = 0)
: 로지스틱에서는 불균형 처리에 도움이 됨 (1~ 10 해보기, 0~inf)
- scale_pos_weight (default = 1)
: sum(negative instances) / sum(positive instances)
- eta : 학습률 (default = 0.3)
- gamma : loss function에서 분할하는데 필요한 최소 reduction (default = 0)
- max_depth : 트리의 최대 크기 (default = 6)
- max_leaf_nodes : 2^max_depth
- lambda : L2 regularization
- alpha (L1 regularization)
3. Learning Task Parameter
- objective : loss function (default = reg:linear)
- eval_metric
5. LightGBM
1. Data 수 감소
- GOSS(Gradient-based One-Side Sampling)
: Tree의 information gain 계산 전 데이터의 일부를 선별
2. Feature 묶음
- EFM(Exclusive Feature Bundling)
: Graph Coloring , 히스토그램 기반 알고리즘을 이용해
split point 정확도를 적게 훼손하며 변수 개수를 효과적으로 감소
1) 어떤 feature들을 묶을 것인가? / What?
2) 그럼 어떻게 묶을 것인지? / How?
: 계산할 Data, Feature수를 줄이자
5. LightGBM
1. GOSS(Gradient-based One-Side Sampling)
Information gain 계산 전 Gradient가 큰 data를 선별하자
- 알고리즘
1) gradient 절대값에 따라 data를 정렬하고 상위 a x 100% 선택 = topSet
2) 나머지 데이터에서 b x 100% 개체를 무작위 표본 추출 = randSet
3) information gain 계산 시 randSet을 1-a / b 만큼 증폭
-> 원 데이터 분포를 많이 바꾸지 않으면서 훈련이 덜 된 개체에 초점
5. LightGBM
1. GOSS(Gradient-based One-Side Sampling)
5. LightGBM
1) 어떤 feature들을 묶을 것인가? / What?
- Graph Coloring 문제로 정의
: NP-hard 다항시간 내에 solution을 찾을 수 없다
- 따라서, Greedy algorithm 적용
: 충돌, 꼭짓점 차수 기준으로
욕심쟁이 탐색
2. EFM(Exclusive Feature Bundling)
고 차원은 sparse 해서 0이 아닌 변수를 동시에 갖는 경우는 거의 없다
ex. One-Hot encoding
feature1 feature2
feature3
conflicts
0이 아닌 값들
5. LightGBM
1) 어떤 feature들을 묶을 것인가? / What?
a. edge마다 weight가 있는 그래프 구성
(weight = 변수 간 총 충돌 횟수 , 없으면 edge X)
b. 꼭지점 차수를 기준으로 내림차순 정렬
c. 작은 충돌(gamma로 제어)이 있는
기존 묶음에 할당하거나 새로운 묶음을 만들자
2. EFM(Exclusive Feature Bundling)
feature1 feature2
feature3
conflicts
0이 아닌 값들
5. LightGBM
2) 그럼 어떻게 묶을 것인지? / How?
- Histogram-based algorithm
: 정렬한 변수 값에서 분할점을 찾는 대신 연속적인 변수 값을 개별 구간으로
나누고 이 구간을 사용하여 split을 찾는다.
2. EFM(Exclusive Feature Bundling)
feature A : [0, 10] feature B : [0, 20]
feature B : [10, 30]
+ 10
feature A : [0, 10]
New_feature C = A + B
= [0, 30]
5. LightGBM
2) 그럼 어떻게 묶을 것인지? / How?
- Histogram-based algorithm 특징 2가지
2. EFM(Exclusive Feature Bundling)
Leaf-wise Growth Ignoring sparse inputs
- Readthedocs 튜닝가이드
1. For Faster Speed
- bagging_fraction , bagging_freq
- feature_fraction
- max_bin
- save_binary
: to speed up data loading in future learning
2. For Better Accuracy
- max_bin : Use large number
- learning_rate : small with large num_iter
- num_leaves
3. Deal with Over-fitting
- max_bin : small
- num_leaves : small
- lambda_l1 , lambda_l2 , min_gain_to_split
- max_depth : small (to avoid growing deep tree)
5. LightGBM
- Kaggle 추천 가이드
-num_leaves
: 2^(max_depth) 추천이나 80보다 큰 경우 더 아래로
-is_unbalance = True
-scale_pos_weight = True
이미지 출처
https://swalloow.github.io
https://www.researchgate.net/figure/Training-of-an-AdaBoost-
classifier-The-first-classifier-trains-on-unweighted-data-
then_fig3_306054843
https://hackernoon.com/gradient-descent-aynk-7cbe95a778da
https://www.kaggle.com/c/home-credit-default-risk/discussion/59806
https://www.microsoft.com/en-us/research/wp-
content/uploads/2017/11/lightgbm.pdf
http://mlexplained.com/2018/01/05/lightgbm-and-xgboost-explained/
https://xgboost.readthedocs.io/en/latest/parameter.html

More Related Content

PPTX
Lecture 18: Gaussian Mixture Models and Expectation Maximization
PPTX
Image Classification And Support Vector Machine
PDF
Overview on Optimization algorithms in Deep Learning
PPTX
Ensemble Method (Bagging Boosting)
PDF
Deep Belief Networks
PDF
Logistic regression
PPTX
Decision Trees
PDF
Artificial Neural Network for machine learning
Lecture 18: Gaussian Mixture Models and Expectation Maximization
Image Classification And Support Vector Machine
Overview on Optimization algorithms in Deep Learning
Ensemble Method (Bagging Boosting)
Deep Belief Networks
Logistic regression
Decision Trees
Artificial Neural Network for machine learning

What's hot (20)

PPTX
Hyperparameter Tuning
PDF
AI_Unit I notes .pdf
PDF
Machine Learning: Generative and Discriminative Models
PDF
Introduction to Machine Learning with SciKit-Learn
PPTX
Support Vector Machine ppt presentation
PDF
Support Vector Machines for Classification
PPTX
PPTX
Ensemble learning
PPTX
Soft computing01
PDF
Bayesian Learning- part of machine learning
PPTX
PPTX
What Is Deep Learning? | Introduction to Deep Learning | Deep Learning Tutori...
PPT
Support Vector Machines
PPTX
AI Agents, Agents in Artificial Intelligence
PDF
Machine Learning - Object Detection and Classification
PPTX
Intel mmx technology ppt by vaishnavi khandelwal
PDF
230309_LoRa
PPTX
Machine Learning and its Applications
PDF
머신 러닝을 해보자 1장 (2022년 스터디)
PPTX
NOMA in 5G Networks
Hyperparameter Tuning
AI_Unit I notes .pdf
Machine Learning: Generative and Discriminative Models
Introduction to Machine Learning with SciKit-Learn
Support Vector Machine ppt presentation
Support Vector Machines for Classification
Ensemble learning
Soft computing01
Bayesian Learning- part of machine learning
What Is Deep Learning? | Introduction to Deep Learning | Deep Learning Tutori...
Support Vector Machines
AI Agents, Agents in Artificial Intelligence
Machine Learning - Object Detection and Classification
Intel mmx technology ppt by vaishnavi khandelwal
230309_LoRa
Machine Learning and its Applications
머신 러닝을 해보자 1장 (2022년 스터디)
NOMA in 5G Networks
Ad

Similar to Boosting_suman (20)

PPTX
Machine learning boosting 20180424
PPTX
Lightgbm_suman
PPTX
Ml for 정형데이터
PDF
boosting 기법 이해 (bagging vs boosting)
PPTX
13.앙상블학습
PPTX
Ensemble Model (Hybrid model)
PDF
파이썬(Python) 으로 나만의 딥러닝 API 만들기 강좌 (Feat. AutoAI )
PDF
3.unsupervised learing(epoch#2)
PDF
DL from scratch(6)
PDF
GBRT tutorial
PDF
From maching learning to deep learning episode2
PDF
지도 학습, 함수 근사와 최적화 문제: 데이터는 우악하니 데이터 사이언스라도 우아하게
PDF
3.unsupervised learing
PDF
Energy based models and boltzmann machines
PPTX
2.supervised learning(epoch#2)-3
PDF
R 스터디 네번째
PPTX
Learning method
PDF
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
PPTX
Mahout
PDF
00_ML 기초_기본개념
Machine learning boosting 20180424
Lightgbm_suman
Ml for 정형데이터
boosting 기법 이해 (bagging vs boosting)
13.앙상블학습
Ensemble Model (Hybrid model)
파이썬(Python) 으로 나만의 딥러닝 API 만들기 강좌 (Feat. AutoAI )
3.unsupervised learing(epoch#2)
DL from scratch(6)
GBRT tutorial
From maching learning to deep learning episode2
지도 학습, 함수 근사와 최적화 문제: 데이터는 우악하니 데이터 사이언스라도 우아하게
3.unsupervised learing
Energy based models and boltzmann machines
2.supervised learning(epoch#2)-3
R 스터디 네번째
Learning method
캐빈머피 머신러닝 Kevin Murphy Machine Learning Statistic
Mahout
00_ML 기초_기본개념
Ad

Boosting_suman

  • 1. Boosting 알고리즘 1. Bagging vs Boosting 2. AdaBoost 3. GBDT 4. XGBoost 5. LightGBM
  • 2. 1. Bagging vs Boosting 앙상블 기법의 종류 : 여러 개의 모델 결과를 합쳐 사용 Variance Bias
  • 3. 2. AdaBoost 가장 기초적인 부스팅 알고리즘 1) 이전 모델의 Error를 기반으로 weight를 계산 2) Exponential Loss function을 이용해 Update
  • 4. 2. AdaBoost 1) Error 계산 2) 가중치 계산 3) Exponential Loss Fucntion을 통해 Update Y : 실제 결과 h : 예측 결과 W_t : t번째 분류기 가중치 - 단점 높은 weight 존재 시 성능이 크게 떨어짐 , 이상치에 약함
  • 5. 3. Gradient Boosting Decision Tree Gradient descent가 크게 일어나는 지점으로 탐색
  • 6. 3. Gradient Boosting Decision Tree 특징 1) 실제값 – 예측값 = h 라 하고 h와 유사한 Loss function을 가정 2) 이전까지 학습된 모델 F 에 대해 미분하면 기울기로 표현됨 음의 기울기가 0으로 수렴하도록 탐색 - 장점 좋은 성능, 다양한 Loss fucntion 지원 - 단점 과적합 위험, 느린 속도 Gradient descent가 크게 일어나는 지점으로 탐색
  • 7. 4. XGBoost : 병렬처리와 Tree 알고리즘을 이용해 속도개선 - CART (Classfication And Regression Trees) 1) CART 알고리즘 적용
  • 8. 4. XGBoost 일반적인 트리 CART 분류기준 Entropy, information gain Gini index 분류방식 Field별 값을 기준으로 분할 이진 트리 과적합방지 X O Leaf Node 데이터 수 조절 최소 변화량 조절 장점 구현 용이 사후 가지치기 가능 Leaf 별 점수할당 단점 Category 속성이 많으면 Tree가 깊어짐, 분기할 Feature 선택에 필요한 계산량 많음 충분한 학습데이터 필요 적을 경우 과적합 유발 - CART (Classfication And Regression Trees) 1) CART 알고리즘 적용
  • 9. 4. XGBoost 𝑂𝑏𝑗 𝜃 = 𝐿𝑜𝑠𝑠 𝜃 + 𝜔(𝜃) 𝜔 𝜃 = 𝛾𝑇 + 1 2 𝛿 𝑗=1 𝑇 𝑤𝑗 2 𝜔 = 𝛾3 + 1 2 𝛿(4 + 0.01 + 1) - Regularization : L1 , L2 식을 통한 과적합방지 2) 함수에 정규화 식 추가로 과적합 방지
  • 10. 4. XGBoost - 다양한 Loss function : Taylor 급수를 이용해 다양한 옵션 제공 4) 다양한 Loss function 지원
  • 11. 4. XGBoost - 주요 Parameter 소개 (Python , Scikit-learn) + 파라미터 조절에 따른 불균형데이터 성능 변화 1. General Parameter : 모양 - booster : 모델의 종류 (default = gbtree) - nthread : 코어 수 - num_feature : feature 수 2. Booster Parameter : - min_child_weight : 관측치들 가중치 합의 최소값 (default = 1) -> 1로 고정 - max_delta_step (default = 0) : 로지스틱에서는 불균형 처리에 도움이 됨 (1~ 10 해보기, 0~inf) - scale_pos_weight (default = 1) : sum(negative instances) / sum(positive instances) - eta : 학습률 (default = 0.3) - gamma : loss function에서 분할하는데 필요한 최소 reduction (default = 0) - max_depth : 트리의 최대 크기 (default = 6) - max_leaf_nodes : 2^max_depth - lambda : L2 regularization - alpha (L1 regularization) 3. Learning Task Parameter - objective : loss function (default = reg:linear) - eval_metric
  • 12. 5. LightGBM 1. Data 수 감소 - GOSS(Gradient-based One-Side Sampling) : Tree의 information gain 계산 전 데이터의 일부를 선별 2. Feature 묶음 - EFM(Exclusive Feature Bundling) : Graph Coloring , 히스토그램 기반 알고리즘을 이용해 split point 정확도를 적게 훼손하며 변수 개수를 효과적으로 감소 1) 어떤 feature들을 묶을 것인가? / What? 2) 그럼 어떻게 묶을 것인지? / How? : 계산할 Data, Feature수를 줄이자
  • 13. 5. LightGBM 1. GOSS(Gradient-based One-Side Sampling) Information gain 계산 전 Gradient가 큰 data를 선별하자 - 알고리즘 1) gradient 절대값에 따라 data를 정렬하고 상위 a x 100% 선택 = topSet 2) 나머지 데이터에서 b x 100% 개체를 무작위 표본 추출 = randSet 3) information gain 계산 시 randSet을 1-a / b 만큼 증폭 -> 원 데이터 분포를 많이 바꾸지 않으면서 훈련이 덜 된 개체에 초점
  • 15. 5. LightGBM 1) 어떤 feature들을 묶을 것인가? / What? - Graph Coloring 문제로 정의 : NP-hard 다항시간 내에 solution을 찾을 수 없다 - 따라서, Greedy algorithm 적용 : 충돌, 꼭짓점 차수 기준으로 욕심쟁이 탐색 2. EFM(Exclusive Feature Bundling) 고 차원은 sparse 해서 0이 아닌 변수를 동시에 갖는 경우는 거의 없다 ex. One-Hot encoding feature1 feature2 feature3 conflicts 0이 아닌 값들
  • 16. 5. LightGBM 1) 어떤 feature들을 묶을 것인가? / What? a. edge마다 weight가 있는 그래프 구성 (weight = 변수 간 총 충돌 횟수 , 없으면 edge X) b. 꼭지점 차수를 기준으로 내림차순 정렬 c. 작은 충돌(gamma로 제어)이 있는 기존 묶음에 할당하거나 새로운 묶음을 만들자 2. EFM(Exclusive Feature Bundling) feature1 feature2 feature3 conflicts 0이 아닌 값들
  • 17. 5. LightGBM 2) 그럼 어떻게 묶을 것인지? / How? - Histogram-based algorithm : 정렬한 변수 값에서 분할점을 찾는 대신 연속적인 변수 값을 개별 구간으로 나누고 이 구간을 사용하여 split을 찾는다. 2. EFM(Exclusive Feature Bundling) feature A : [0, 10] feature B : [0, 20] feature B : [10, 30] + 10 feature A : [0, 10] New_feature C = A + B = [0, 30]
  • 18. 5. LightGBM 2) 그럼 어떻게 묶을 것인지? / How? - Histogram-based algorithm 특징 2가지 2. EFM(Exclusive Feature Bundling) Leaf-wise Growth Ignoring sparse inputs
  • 19. - Readthedocs 튜닝가이드 1. For Faster Speed - bagging_fraction , bagging_freq - feature_fraction - max_bin - save_binary : to speed up data loading in future learning 2. For Better Accuracy - max_bin : Use large number - learning_rate : small with large num_iter - num_leaves 3. Deal with Over-fitting - max_bin : small - num_leaves : small - lambda_l1 , lambda_l2 , min_gain_to_split - max_depth : small (to avoid growing deep tree) 5. LightGBM - Kaggle 추천 가이드 -num_leaves : 2^(max_depth) 추천이나 80보다 큰 경우 더 아래로 -is_unbalance = True -scale_pos_weight = True
  • 20. 이미지 출처 https://swalloow.github.io https://www.researchgate.net/figure/Training-of-an-AdaBoost- classifier-The-first-classifier-trains-on-unweighted-data- then_fig3_306054843 https://hackernoon.com/gradient-descent-aynk-7cbe95a778da https://www.kaggle.com/c/home-credit-default-risk/discussion/59806 https://www.microsoft.com/en-us/research/wp- content/uploads/2017/11/lightgbm.pdf http://mlexplained.com/2018/01/05/lightgbm-and-xgboost-explained/ https://xgboost.readthedocs.io/en/latest/parameter.html

Editor's Notes

  • #5: 이상치에 약하다, 단순 오차만 고려해 정답값을 찾아 속도가 느리다./ 이상치 데이터, 일반데이터 성능비교