Introduction to Linear Modeling in Python
Jason Vestuto
Data Scientist
Chapter Roadmap:
# Range of y data, in miles
y_range = np.max(y) - np.min(y) = 300 - 0 = 300
# Range of x data, in hours
x_range = np.max(x) - np.min(x) = 6 - 0 = 6
# Estimating the speed
mph = y_range / x_range = 300 / 6 = 50
# Model as python expression
miles = 50*hours
# Model predicts distance is 300 miles at 6 hours
time = 6
distance = 50 * time = 50 * 6 = 300
def model(time):
return 50*time
predicted_distance = model(time=10)
Introduction to Linear Modeling in Python