Linear Programming for Linear Regression in Python

For Operations Research, Quantitative Finance, Economics, and More

Register for this Course

$9.99 $20.00 USD 50% OFF!

Login or signup to register for this course

Have a coupon? Click here.

Course Data

Lectures: 12
Length: 1h 07m
Skill Level: All Levels
Languages: English
Includes: Lifetime access

Course Description

One of the most common questions I get in my Linear Regression class is, "What if we use the absolute error instead of the squared error?"

The answer is: this is entirely possible, but it requires an entirely different solution method.

These techniques are not usually taught in machine learning, yet they are essential to many fields such as operations research, quantitative finance, engineering, manufacturing, logistics, and more.

The main technique we will learn how to apply is called Linear Programming.

We will study several alternative loss functions for linear models, such as the L1 (absolute) loss, maximum absolute deviation (MAD), and the exponential loss for when you want your error to be positive-only or negative-only.

These techniques are part of a broader field of study known as convex optimization.

I hope you will join me in learning this essential skill for today's data science and quantitative professionals.

See you in class!

Suggested Prerequisites:

  • calculus
  • matrix arithmetic (adding, multiplying)
  • probability
  • be able to derive linear regression on paper and code linear regression in Python
  • Python coding: if/else, loops, lists, dicts, sets
  • Numpy coding: matrix and vector operations, loading a CSV file


Welcome and Review

2 Lectures · 12min

Linear Programming for Linear Regression

10 Lectures · 54min
  1. Linear Programming Example (08:21)
  2. Linear Programming Example in Code (04:57)
  3. Absolute Error (L1 Loss) Maximum Likelihood (03:02)
  4. Absolute Error (L1 Loss) Linear Program (08:03)
  5. Absolute Error (L1 Loss) Code (06:01)
  6. Maximum Absolute Deviation Theory (05:05)
  7. Maximum Absolute Deviation Code (02:45)
  8. Exponential Maximum Likelihood (04:39)
  9. Exponential Linear Program (07:32)
  10. Exponential Code (04:03)


  • Linear Programming Example Notebook
  • Linear Programming Linear Regression Notebook
This website is using cookies. That's Fine