Closed johnwmillr closed 6 years ago
It is preferable to use np.linalg.lstsq
instead of calculating an inverse matrix.
Sorry for this delay.
I've just had a look into books, both 'Elements of Statistical Learning' and 'Machine Learning: A Probabilistic Perspective' use non-capital y
(which sounds more reasonable to me).
Thanks for this list, it's very helpful!
This is a nitpicky suggestion which you can take or leave. I suggest you use
Y
instead ofb
in your ridge regression example. The difference term,||AX-b||
, is comparing the output of the model,AX
, to the true output value, which I think is more commonly labeledY
rather thanb
.Here's the Wikipedia page on ridge regression for reference.
My change:
Matrix multiplication with @
Let's implement one of the simplest ML models — a linear regression with l2 regularization (a.k.a. ridge regression):