The empirical risk is
For ,
so is a convex function. Each signed margin is an affine function of , and composition with an affine function preserves convexity. Equivalently,
is a positive semidefinite matrix. Therefore is convex.