머신러닝 알고리즘입니다. 또한 매우 복잡한 데이터셋도 학습할 수 있는 강력한 알고리즘입니다.
예를 들어
2
장에서 캘리포니아 주택 가격 데이터셋을 완벽하게 맞추는
DecisionTreeRegressor
모델을 훈련시켰습니다(사실 과대적합입니다).
결정 트리는 최근에 자주 사용되는 가장 강력한 머신러닝 알고리즘 중 하나인 랜덤 포레스트(
7
장 참조)의 기본 구성 요소이기도 합니다.
이 장에서는 결정 트리의 훈련, 시각화, 예측 방법에 대해 먼저 살펴보겠습니다. 그런 다음 사이
킷런의
CART
훈련 알고리즘을 둘러보고 트리에 규제를 가하는 방법과 회귀 문제에 적용하는
방법을 배우도록 하겠습니다. 마지막으로 결정 트리의 제약사항에 관해 이야기하겠습니다.
6.1
결정 트리 학습과 시각화
결정 트리를 이해하기 위해 일단 하나를 만들어서 어떻게 예측을 하는지 살펴보겠습니다. 다음
은 붓꽃 데이터셋(
4
장 참조)에
DecisionTreeClassifier
를 훈련시키는 코드입니다.
결정 트리
CHAPTER
6
226
1
부
머신러닝
from sklearn
.
datasets import load
_
iris
from sklearn
.
tree import DecisionTreeClassifier ...
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.