수업을 들었다면 아마도 마지막에 선형 회귀를 다루었을 것입니다. 선형 회귀 그리고 여기에서
확장된 알고리즘은 타깃 벡터가 수치형(예를 들면 주택 가격, 나이)일 때 널리 유용하게 사용
됩니다. 이 장에서는 높은 성능의 예측 모델을 만들기 위한 다양한 선형 회귀 방법(그리고 확
장된 알고리즘)을 소개하겠습니다.
13.1
직선 학습하기
과제
특성과 타깃 벡터 사이의 선형 관계를 표현하는 모델을 훈련하고 싶습니다.
해결
선형 회귀를 사용합니다(사이킷런의
LinearRegression
).
# 라이브러리를 임포트합니다.
fromsklearn.linear_modelimport LinearRegression
fromsklearn.datasetsimportmake_regression
# 특성 행렬과 타깃 벡터를 만듭니다.
features,target=make_regression(n_samples=100,
n_features=3,
선형 회귀
13
CHAPTER
332
실무로 통하는
ML
문제 해결
with
파이썬
n_informative=2,
n_targets=1,
noise=0.2,
coef=
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.