I want to calculate the subgradient of the following function: $$f(w, b) = \max \{0, v(w^T u + b)\}+ \rho\|w\|_{l^1}$$ where $u\in \mathbb{R^n}$ and $v\in \mathbb{R}$ are given, $w \in \mathbb{R^n}$ values and $\rho \in \mathbb{R}$.
I guess we have to divide it into three cases :
- if $0< v(w^T u + b)$: so $f(w, b) = v(w^T u + b)+ \rho\|w\|_{l^1}$ then:
$$\partial f(w, b) = \bigl(\begin{matrix} uv + \rho s\\ v \end{matrix}\bigr)$$ where $s_i = \left\{\begin{matrix} 1 \ &, \text{if} \ w_i >0 \\ -1 &,\text{if} \ w_i < 0 \\ -1 or 1 &,\text{if} \ w_i = 0 \end{matrix}\right.$
if $0 > v(w^T u + b)$: $$\partial f(w, b) = \bigl(\begin{matrix} \rho s\\ 0 \end{matrix}\bigr)$$ $s$ as above.
if $0 = v(w^T u + b)$ : either of above two cases.
The subdifferential is the convex hull of all subgradients. Would the convex hull of the above functions be as below? $$\partial f(w,b) = \Big\{ \alpha \begin{pmatrix} uv \\ v \end{pmatrix} + \begin{pmatrix} s \\ 0 \end{pmatrix} : \alpha \in [0,1]\Big\}$$