Ensemble의 diversity는 data diversity, model diversity 두가지가 있는데, bagging은 data diversity에 관한 것이다.
K-fold 교차 검증은 단일 데이터 분할보다 신뢰성이 높고, 모델의 일반화 성능을 더 정확하게 평가할 수 있도록 도와줍니다. 이를 통해 모델이 특정 데이터에 과적합되지 않고 다양한 데이터에 대해 효과적으로 작동하는지를 확인할 수 있다.
K-fold 데이터 분할은 기계 학습에서 모델의 성능을 평가하고 향상시키기 위해 사용된다. 여러 번의 실험을 수행하고 결과를 평균 내어 모델의 성능을 더 신뢰할 수 있게 평가할 수 있다.
여러개의 bootstrap 자료를 생성하고 각 자료를 모델링한 후 결합하여 최종 예측 모델을 산출한다.
bootstrap 자료란 raw data로부터 복원 임의 추출한 크기가 동일한 여러개의 표본자료이다.
대표적으로 랜덤 포레스트 알고리즘을 사용하여 overfitting 방지에 효과적이며 수행속도가 빠르다는 장점이 있다.
sampling with replacement: 복원추출
- 똑같은 데이터가 여러번 선택될수도, 아예 선택이 안될수도 있다.
- 원하는 만큼 bootstap 추출 가능
- 데이터가 가진 분포를 바꿈: 왜곡을 통해 종속적인 데이터가 만들어질 수 있는 위험을 줄인다.
stage1에서 복원추출 데이터 사용
stage 2에 any supervised learning algorithm 써도 상관없음
- Classification problem
![](https://velog.velcdn.com/images/yomilimi/post/a2c07a1f-f375-4305-a984-629bf0252f45/image.png)
1. majority voting
predictied class label만 사용해서 결과 구한다.
![](https://velog.velcdn.com/images/yomilimi/post/7db5ad4a-70ca-484b-ab51-c5aae8a95f84/image.png)
2. weighted voting
가중치 준다.
![](https://velog.velcdn.com/images/yomilimi/post/bdd05fd2-0990-41b6-bcd3-f73e64629364/image.png)
- Regression problem: 단순 평균
specialized bagging for decision tree algorithms: tree가 여러 개 모여서 forest가 됨
Two ways to increase the diversity of ensemble
1. bagging
2. randomly chosen predictor variables
sampling with replacement
randomly selected variable
변수를 선택적으로 사용하자
B 각각 성능이 떨어져도 이들을 합치면 성능이 올라간다.
개별 모델들의 성능이 좋고, 모델간의 연관성이 없을수록 Generalization error가 낮아진다.
step1: compute the OOB error for the original dataset(ei)
step2: compute the OOB error for the dataset in which the variable xi is permutes(pi)
step3: compute the variable importance based on the mean and standard deviation of(pi-ei) over all trees in the population: pi-ei가 클수록 중요함
랜덤 포레스트에서 변수의 중요도가 높다면
1) Random permutation 전-후의 OOB Error차이가 크게 나타나야 하며,
2) 앙상블 개별적인 트리마다 그 차이의 편차가 적어야 함: 일관성 있게 중요해야 됨