ComeçarComece de graça

Reasons for Modeling: Extrapolation

Another common use of modeling is extrapolation to estimate data values "outside" or "beyond" the range (min and max values of time) of the measured data. In this exercise, we have measured distances for times 0 through 5 hours, but we are interested in estimating how far we'd go in 8 hours. Using the same data set from the previous exercise, we have prepared a linear model distance = model(time). Use that model() to make a prediction about the distance traveled for a time much larger than the other times in the measurements.

context figure

Este exercício faz parte do curso

Introduction to Linear Modeling in Python

Ver curso

Instruções do exercício

  • Use distance = model(time) to extrapolate beyond the measured data to time=8 hours.
  • Print the distance predicted and then check whether it is less than or equal to 400.
  • If your car can travel, at most, 400 miles on a full tank, and it takes 8 hours to drive home, will you make it without refilling? You should have answer=True if you'll make it, or answer=False if you will run out of gas.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Select a time not measured.
time = 8

# Use the model to compute a predicted distance for that time.
distance = model(____)

# Inspect the value of the predicted distance traveled.
print(distance)

# Determine if you will make it without refueling.
answer = (____ <= 400)
print(answer)
Editar e executar o código