I am wondering if function of this form is convex: $h(x)=\max(1,1-ax)(x-a)^2$. Basically, if $x$ has the same sign as $a$, it is regular quadratic function, otherwise it is of 3rd order. I plotted for both $a>0$ and $a<0$, it seems convex by eyeball. Would you help me confirm that this function is indeed convex and global minimum is guaranteed? Thanks a lot!
Is this function (hinge loss times squared error) convex?
1
$\begingroup$
convex-analysis
convex-optimization
-
1If you need only a global miminum, this property holds also for uimodal functions: nonincreasing for $x
x_0$. To check convexity you could use the fomula $\max(a,b)=\frac{1}{2}(a+b+|a-b|)$. Check that $f$ is convex on $(-\infty,0)$ as well as on $(0,\infty)$. Then find any support line at $0$. Then $f$ is convex everywhere. This is my idea for this problem. Since I did not check the details, I put it in a comment. Observe that $0$ is the only non-differentiability point. – 2017-01-13 -
0Yes, for $a \geq 0$ this is convex (perhaps also for $a<0$ but I did not check). As szw1710 suggests, you can just check cases $x\geq 0$ and $x<0$ separately. In both cases the derivatives are nondecreasing, and I observe the left derivative at $x=0$ is less than or equal to the right-derivative at $x=0$. – 2017-01-13
-
0@Michael convexity for $x\geq 0$ and $x<0$ does not guarentee convexity on $\mathbb{R}$. – 2017-01-13
-
0@LinAlg : But the last property at $x=0$ ensures the two curves paste together convexly (together with continuity of the function at $x=0$). So you get a "$v$" shape rather than an "$\omega$" shape. – 2017-01-13
-
0@Michael together with continuity I think you are right – 2017-01-13
1 Answers
2
Since $(x-a)^2 \geq 0$ you can rewrite $h$ to $h(x) = \max\{(x-a)^2, (1-ax)(x-a)^2\}$. Since the second function is only larger than the first one if $ax \leq 0$, you can replace its value for $ax\geq 0$ without changing $h$. Define
$$g(x) = \begin{cases}(1-ax)(x-a)^2 & \text{if } ax \leq 0 \\ a^2 - (a^3+2a)x & \text{else.} \end{cases}$$ Since the first branch is convex, and the second branch is just the tangent of the first branch at $x=0$, the function $g$ is convex. Now $h(x) = \max\{(x-a)^2, g(x)\}$, i.e., the maximum of two convex functions, and therefore convex.
-
0Simply brilliant. – 2017-01-13
-
0@sciencemonk thanks, maybe accept the answer then :) – 2017-01-15