모델링의 이유: 보간법
모델링의 흔한 활용 중 하나는 측정된 데이터 포인트 "사이" 또는 "중간"의 값을 구하는 보간법(interpolation)입니다. 이 연습 문제에서는 독립 변수 times가 두 측정값 사이에 있을 때, 종속 변수 distances의 값을 예측해 봅니다. 여기서 distances는 주어진 경과 시간에 이동한 거리입니다.

이 연습은 강의의 일부입니다
Python으로 배우는 선형 모델 입문
연습 안내
- 미리 정의된 데이터 배열
times와distances, 그리고 미리 로드된 플롯을 확인하세요. - 대략적인 점검을 바탕으로,
elapse_time = 2.5시간일 때 시작 위치에서 떨어진distance_traveled를 추정하세요. - 추정한 값을
distance_traveled에 할당하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Compute the total change in distance and change in time
total_distance = ____[-1] - ____[0]
total_time = ____[-1] - ____[0]
# Estimate the slope of the data from the ratio of the changes
average_speed = total_distance / total_time
# Predict the distance traveled for a time not measured
elapse_time = 2.5
distance_traveled = average_speed * elapse_time
print("The distance traveled is {}".format(distance_traveled))