Locally weighted linear regression predicts at a query by minimising with weights . For the data , bandwidth and query , compute the prediction. How does it compare with the ordinary least-squares prediction at ?
Supervised learning, Locally weighted regression
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.
What's being asked
Whether you can run weighted least squares by hand and explain that LWR fits a fresh local line for every query.
Key idea
Solve the weighted normal equations and predict .
Steps
- Compute the weights for : , , . Nearby points count more.
- Form the weighted sums: , , , , .
- The weighted normal equations are . The determinant is .
- Solve: and .
- The prediction at is .
- Ordinary least squares uses equal weights. For these three points the slope is and the intercept is , so it predicts at . LWR gives because it trusts the point more and the distant less.
- Because the weights change with , LWR is non-parametric: it needs the training data at prediction time and refits for every query.
Common mistakes
- Using or forgetting the factor 2, which changes the bandwidth.
- Applying the weights to the inputs instead of to the squared errors, or normalising weights and then forgetting the normalisation elsewhere.
- Thinking the fitted curve is a single global model. The parameters are recomputed for each query point.
How long your answer should be
Half a page with a small table of weights; 5 minutes.
Read this
Previous in Supervised learning: Kernel ridge regression uses the kernel on one-dimensional inputs, with penalty . The training data are and . Find the dual coefficients and predict at . Why is the dual form useful?
Next in Supervised learning: The pinball (quantile) loss for level is if and if , with . Show that the constant minimising is the -quantile of . How do you check it numerically for on ?