# Fitting a linear model to data, cont'd

Pointwise errors ei = αxi + β − yi

Some freedom in defining overall error E in terms of pointwise errors {ei}

We found a formula the line that minimizes the choice E = ni = 1e2i

argmin(α, β) ∈ ℝ2 E

## Quiz 6

Examples of minimizer of E = ni = 1|ei|

How to find best (α, β) for other choices?

# Brute force?

Random choices of (α, β)

Grid of points (α, β) (harder!)

Rules

Applications

## Setting the seed in numpy.random

Reproducibility of random results with numpy.random.seed()

My conjecture: a line containing 2 of the data points is in argmin E when we choose E = ni = 1|ei|. (If true, this narrows down the possibilities to a finite set.)

scatter()

# More efficient finding of minimizer?

Stagger downhill?

# Project 3

A comparative study of several definitions of badness of fit of a linear function to data {(xi, yi) ∈ ℝ2 : i ∈ {1, 2, ..., n}}

Looking for best-fit line according to several definitions of error for a variety of data sets (large/small, regular/irregular), and your own personal value judgments based on the examples you present.