Week 1 Lecture 3
Linear regression
Derivatives recap
Multivariate chain rule
Linear regression
Predicting target variable , based on (for now, let )
(where and )
We can get rid of the parameter by defining: and
Then:
(Basically add another dimension ranging from to (from to ), so the equation works pretty much the same) what
Letโs omit the tilde for easier usage.
The training data can be gathered into a matrix:
You can index it with (even partially). The notation is to keep it โsimpleโ.
Our goal is still to minimize risk.
Using squared loss: (Mean squared error)
If has full rank, optimal parameters are given by:
is the pseudoinverse
note: vectors wonโt produce an outer product with full rank (just 1)
Deriving Linear Regression
Overdetermined case
Probably see the slides
Underdetermined case
At times the data points are fewer than the the amount of parameters available, the (resulting matrix) rank will not be full, and many solution can give us 0 error. In that case, minimization of the norm might be a good idea.
We want to find the weights with minimal norm, that still goes through every datapoint:
(norm) such that (linear constraint)
In this case, the gradient at the optimal point must be a linear combination of the normal (perpendicular) vectors of the constraint.
Notice the order has changed
Singular value decomposition (SVD)
for
- (semi-orthogonal)
- with
- semi-orthogonal
Computation is not includedโฆ Exercise for the reader implementorโฆ
Likelihood function
Also see the presentation