또는 특성에서 가장 자주 등장하는 클래스로 누락된 값을 채우거나 아예 누락된 값이 있는 샘
플을 제외할 수 있습니다.
KNN
보다 덜 정교하지만 대규모 데이터에 적용하기 훨씬 쉽습니다.
어떤 경우든 대체된 값이 있는 샘플인지 나타내는 이진 특성을 추가하는 것이 좋습니다.
참고
•사이킷런 문서: 누락된 값 대체하기(
https
://
oreil
.
ly
/
1M4bn
)
•랜덤 포레스트
random
forest
분류기에서 누락된 값 극복하기(
http
://
bit
.
ly
/
2HSsNBF
)
•대체 방법으로서
k
-최근접 이웃 연구(
http
://
bit
.
ly
/
2HS9sAT
)
5.5
불균형한 클래스 다루기
과제
타깃 벡터가 매우 불균형한 클래스로 이루어져 있어 이를 조정하여 균형 있게 만들려고 합니다.
해결
더 많은 데이터를 모으세요. 이것이 불가능하면 모델 평가 지표를 바꾸세요. 잘 동작하
지 않으면 (가능하다면) 모델에 내장된 클래스 가중치 매개변수를 사용하거나 다운샘플링이나
업샘플링을 고려해보세요. 이후 장에서 평가 지표를 다루겠습니다. 여기에서는 클래스 가중치
매개변수, 다운샘플링, 업샘플링에 초점을 맞춥니다.
예제를 위해 클래스가 불균형한 데이터를 준비하겠습니다. 피셔의 붓꽃 데이터셋은 붓꽃의 품
종을 나타내는 세 개 클래스(
Iris
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.