선형 관계 시각화

Python으로 배우는 선형 모델 입문

Jason Vestuto

Data Scientist

빠른 플롯

import matplotlib.pyplot as plt
plt.plot(x, y, 'r-o')
plt.show()

Python으로 배우는 선형 모델 입문

객체 인터페이스

# Import the pyplot module
import matplotlib.pyplot as plt
# Create figure and axis objects
fig, axis = plt.subplots()
# Prepare initial style options
options = dict(marker='o', color='blue')
Python으로 배우는 선형 모델 입문

객체 인터페이스

# Call the plot method on the axis object
line = axis.plot(x, y, **options)
# Modify the axis object with set methods
_ = axis.set_ylabel('Times')
_ = axis.set_xlabel('Distances')
# Display figure
plt.show()
Python으로 배우는 선형 모델 입문

선형 데이터 시각화

  • 두 점:
    • (x1,y1) = (0,0)
    • (x2,y2) = (2,3)
  • x와 y의 변화량:
    • dy = (y2 - y1) = 3 - 0
    • dx = (x2 - x1) = 2 - 0
  • 기울기 = 수직 변화 / 수평 변화
    • slope = dy/dx = 3/2
  • 절편:
    • x=0일 때: y1 = 0

기울기를 rise over run으로 나타낸 플롯

Python으로 배우는 선형 모델 입문

연습해 봅시다!

Python으로 배우는 선형 모델 입문

Preparing Video For Download...