1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Learning with PySpark

Exercise

Interpreting the coefficients

The linear regression model for flight duration as a function of distance takes the form

\(\text{duration} = \alpha + \beta \times \text{distance}\)

where

  • \(\alpha\) — intercept (component of duration which does not depend on distance) and
  • \(\beta\) — coefficient (rate at which duration increases as a function of distance; also called the slope).

By looking at the coefficients of your model you will be able to infer

  • how much of the average flight duration is actually spent on the ground and
  • what the average speed is during a flight.

The linear regression model is available as regression.

Instructions

100 XP
  • What's the intercept?
  • What are the coefficients? This is a vector.
  • Extract the element from the vector which corresponds to the slope for distance.
  • Find the average speed in km per hour.