I have the lasso regression formula: $\left \| y-X\beta \right \|_2^2 st. \left \| \beta \right \|_1$ in a loop I am computing the value of $\beta$ until the algorithm stops.
Sometimes the algorithm is not stopping because it is reaching a local minimum and is computing the same values of $\beta$.
At that moment I want to say if the gradient is smaller than a value e.g. $10^-3$ the algorithm should stop.
The problem is I computed the gradient for the Loss so: $\Delta L(\beta;X,y)=2X^t(y-X\beta)$ which gives me a vector, that I cannot compare with the value $10^-3$
Is there any other formula that I could use to calculate the gradient, that would return a value?