Introduction to the Course

Pengantar Pemodelan Linear di Python

Jason Vestuto

Data Scientist

Introduction to Chapter 1

Chapter Roadmap:

  • Motivating Examples
  • Data Visualization
  • Descriptive Statistics
Pengantar Pemodelan Linear di Python

Example Trip Data

Plot of points, Distance versus Time, miles versus hours

Pengantar Pemodelan Linear di Python

Models as Descriptions

# 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
Pengantar Pemodelan Linear di Python

Visualizing a Model

Plot of data and model, distance versus time

Pengantar Pemodelan Linear di Python

Model Predictions

# 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)
Pengantar Pemodelan Linear di Python

Interpolation

Plot of distance versus time, with interpolation point marked between two data points

Pengantar Pemodelan Linear di Python

Extrapolation

Plot of distance versus time, with extrapolation point marked outside data points at greater time

Pengantar Pemodelan Linear di Python

Let's practice!

Pengantar Pemodelan Linear di Python

Preparing Video For Download...