세 개의 수치형 변수 시각화
3D 플롯의 "평면" 대안도 있는데, 해석이 더 쉬운 대신 약간의 사고가 필요해요. 좋은 방법은 두 개의 수치형 설명 변수를 산점도의 x축과 y축에 놓고, 응답 변수를 기준으로 점의 색을 지정하는 것이에요.
taiwan_real_estate가 제공되어 있어요.
이 연습은 강의의 일부입니다
Python의 statsmodels로 배우는 중급 회귀
연습 안내
- 가장 가까운 MRT 정거장까지의 거리에 제곱근을 취해
sqrt_dist_to_mrt_m로 저장하세요. taiwan_real_estate데이터셋으로,sqrt_dist_to_mrt_m를 x축, 근처 편의점 수를 y축으로 하고, 집값으로 색을 입힌 산점도를 그리세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Transform dist_to_mrt_m to sqrt_dist_to_mrt_m
taiwan_real_estate["sqrt_dist_to_mrt_m"] = ____
# Draw a scatter plot of sqrt_dist_to_mrt_m vs. n_convenience colored by price_twd_msq
____
# Show the plot
plt.show()