# How can I model regression with an asymmetric loss function?

Mosek provided a concrete example of using the Huber loss function, Huber loss, which is great!

One problem I am trying to tackle is to use asymmetric loss, as described in the answer of asymmetric loss.

Simply speaking, instead of using a classic quadratic square error loss, the loss function becomes:

\begin{align}e &= y-y_{\text{predicted}}\\\text{loss} &= x\cdot x \cdot (\operatorname{sgn}(x) + a) \cdot(\operatorname{sgn}(x) + a).\end{align}

As you can see, the loss is not quadratic any more. The advantage of using some loss function, is that we can penalize under-estimate and over-estimate differently.

Can we somehow restructure the problem and make it solvable by Mosek (or other optimization tools)?

• Hi eight3, your function needs to be expressed as a conic problem if you want to solve it via Mosek. They feature quadratic (normal & rotated second-order cones), semidefinite, power and exponential cones. If you (or some other member of OR.SE) are able to rewrite it using one of these, then you can solve it. If it can be rewritten as a quadratic problem, then you can also use other solvers such as gurobi, xpress or cplex... – JakobS Sep 23 '19 at 12:52

I suspect you want to minimize $$\sum\limits_i \left[k_1\max(e_i,0)^2 + k_2\max(-e_i,0)^2\right]$$. For instance, $$a=0.5$$ would correspond to $$k_1 = 0.25$$ and $$k_2 = 2.25$$).
This can be formulated as a quadratic program by introducing new variables $$u$$ and $$v$$, using the objective $$k_1 u^\top u + k_2 v^\top v$$ with the constraints $$u\geq 0, u \geq e, v\geq 0, v\geq -e$$.