이터셋과 계층 샘플링으로 만든 테스트 세트에서 소득 카테고리 비율을 비교한 것입니다. 그림
에서 보듯이 계층 샘플링을 사용해 만든 테스트 세트가 전체 데이터셋에 있는 소득 카테고리의
비율과 거의 같습니다. 반면 일반 무작위 샘플링으로 만든 테스트 세트는 비율이 많이 달라졌습
니다.
그림
2-10
계층 샘플링과 순수한 무작위 샘플링의 샘플링 편향 비교
전체무작위 샘플링계층 샘플링무작위 샘플링 오류율계층 샘플링 오류율
이제
income
_
cat
특성을 삭제해서 데이터를 원래 상태로 되돌리겠습니다.
26
for set
_
in
(
strat
_
train
_
set
,
strat
_
test
_
set
):
set
_
.
drop
("
income
_
cat
",
axis
=
1
,
inplace
=
True
)
테스트 세트 생성에 대해 자세히 설명한 데는 그럴 만한 이유가 있습니다. 종종 등한시되기도
하지만 머신러닝 프로젝트에서 아주 중요한 부분이기 때문입니다. 게다가 이런 아이디어들은
나중에 교차 검증에 대해 이야기할 때 도움이 됩니다. 이제 데이터를 탐색하는 다음 단계로 넘
어갑시다.
2.4
데이터 이해를 위한 탐색과 시각화
지금까지는 다뤄야 할 데이터의 종류를 파악하기 위해 데이터를 간단히 ...
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.