Thank you for all your help it has been really appreciated. I have one final question, do you know if there is a closed form solution to

(assuming

is a vector with the same number of rows as x?)

i.e., the closed form solution as used for linear regression and regularization - copied from lecture notes is this:

I am not sure where

would end up in the above, the derivation is beyond me mathematically?