Problem 55185. Ridge regularized linear regression
Given a predictor data matrix X of size
, target variable vector y of size
and a shrinkage factor λ (scalar) (ridge regularization), write the function to compute linear regression model coefficients β
to model the data. The data has n observations, p predictor variables in the X matrix
The model is defines as:
where sigma is gaussian noise.
(Hint: search on google for closed form solution of a linear regression problem)
Solution Stats
Problem Comments
-
2 Comments
ChrisR
on 14 Jul 2022
Yuvraj, this problem looks interesting, and I was looking forward to learning about ridge regularization. I suggest that you remove the code from the function template: you are giving us the answer! Also, several Cody players have recommended at least four tests to discourage lookup table solutions and other cheats.
Christian Schröder
on 12 Nov 2022
The test suite's incorrect: the matrix inversion in the ridge estimator is missing.
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
Return a list sorted by number of occurrences
2753 Solvers
-
1516 Solvers
-
Fahrenheit to Celsius converter
544 Solvers
-
Create an n-by-n null matrix and fill with ones certain positions
574 Solvers
-
Generate binary combinations for a given number of bit(s)
92 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!