결정 트리는 훈련 데이터에 대한 제약사항이 거의 없습니다(반대로 선형 모델은 데이터가 꼭 선
형일 거라 가정합니다). 제한을 두지 않으면 트리가 훈련 데이터에 아주 가깝게 맞추려고 해서 대
부분 과대적합되기 쉽습니다. 결정 트리는 모델 파라미터가 전혀 없는 것이 아니라(보통 많습니
다) 훈련되기 전에 파라미터 수가 결정되지 않기 때문에 이런 모델을 비파라미터 모델
nonparametric
model
이라고 부르곤 합니다. 그래서 모델 구조가 데이터에 맞춰져서 고정되지 않고 자유롭습니
다. 반대로 선형 모델 같은 파라미터 모델
parametric
model
은 미리 정의된 모델 파라미터 수를 가지
므로 자유도가 제한되고 과대적합될 위험이 줄어듭니다(하지만 과소적합될 위험은 커집니다).
훈련 데이터에 대한 과대적합을 피하기 위해 학습할 때 결정 트리의 자유도를 제한할 필요가 있
습니다. 이미 알고 있듯이 이를 규제라고 합니다. 규제 매개변수는 사용하는 알고리즘에 따라 다
르지만, 보통 적어도 결정 트리의 최대 깊이는 제어할 수 있습니다. 사이킷런에서는
max
_
depth
매개변수로 이를 조절합니다(기본값은 제한이 없는 것을 의미하는
None
입니다).
max
_
depth
를
줄이면 모델을 규제하게 되고 과대적합의 위험이 감소합니다. ...
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.