Implement kernel ridge regression
CodingIntermediate⏱ 1 hourClassical MLkernel ridgeimplementationbandwidtheffective dof
Problem
Implement kernel ridge regression with a Gaussian kernel.
- Fit a one-dimensional function and visualise the effect of and .
- Plot the representer expansion term by term and check the terms sum to the fit.
- Compute the effective degrees of freedom and relate it to the visual smoothness.
- Select by cross-validation and compare with the visually best fit.
Implement it, then check the implementation against something you can verify independently.
Write it
Solve it here5 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 40s · draft saved in this browser
5 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.
Solution
Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.
Related problems
All problems| Solved | Problem | Field | Type | Difficulty | Time |
|---|---|---|---|---|---|
| Implement backpropagation from scratch run | Deep Learning | Coding | 3 hours | ||
| Implement multi-head attention from scratch run | Deep Learning | Coding | 3 hours | ||
| Implement power iteration and verify the convergence rate run | Foundations | Coding | 1 hour | ||
| Implement random projection and measure the distortion run | High-Dim Probability | Coding | 1 hour | ||
| Implement ridge and find the optimal lambda run | Classical ML | Coding | 1 hour |