시작하기무료로 시작하기

모델 적합하기

한 대학교에서 공부 시간과 특정 시험 점수 사이의 관계를 보여주는 데이터를 제공했습니다.

hours_of_studyscores 변수로 해당 데이터에 접근할 수 있어요. 선형 모델을 사용해 데이터에서 학습해 보세요.

이 연습은 강의의 일부입니다

Python으로 배우는 확률 기초

강의 보기

연습 안내

  • scipy.stats에서 linregress() 함수를 임포트하세요.
  • hours_of_studyscores 변수에 있는 제공된 데이터를 사용해 선형 모델을 적합하세요.
  • 파라미터를 출력하세요.

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Import the linregress() function
from scipy.stats import ____

# Get the model parameters
slope, intercept, r_value, p_value, std_err = ____(____, ____)

# Print the linear model parameters
print('slope:', ____)
print('intercept:', ____)
코드 편집 및 실행