
184
데이터 과학을 위한 통계
house_lm house_wt
(Intercept) -521871.368 -584189.329
SqFtTotLiving 228.831 245.024
SqFtLot -0.060 -0.292
Bathrooms -19442.840 -26085.970
Bedrooms -47769.955 -53608.876
BldgGrade 106106.963 115242.435
가중회귀의 계수를 보면 기존 회귀분석의 결과와는 살짝 다른 것을 알 수 있다.
사이킷런의 대부분 모델은
fit
메서드 호출 시, 키워드 인수
sample
_
weight
로 가중치를 허용
한다.
predictors = [‘SqFtTotLiving’, ‘SqFtLot’, ‘Bathrooms’, ‘Bedrooms’, ‘BldgGrade’]
outcome = ‘AdjSalePrice’
house_wt = LinearRegression()
house_wt.fit(house[predictors], house[outcome], sample_weight=house.Weight)
4.2.6
더 읽을 거리
• 개러스 제임스
, 다니엘라 위튼, 트레버 해스티, 로버트 팁시라니 등이 쓴 『
An
Introduction
to
Statistical
Learning
』(
Springer
,
2013
)에서 교차 검증과 재표본에 ...