# How to design and implement an asymmetric loss function for regression?

## Problem

In regression one usually computes the mean squared error (MSE) for a sample: $$\text{MSE} = \frac{1}{n} \sum_{i=1}^n\left(g(x_i) - \widehat{g}(x_i)\right)^2$$ to measure the quality of a predictor.

Right now I'm working on a regression problem where the goal is to predict the price customers are willing to pay for a product given a number of numeric features. If the predicted price is too high no customer will buy the product, but the monetary loss is low because the price can simply be decremented. Of course it should not be too high as then the product may not be bought for a long time. On the other hand if the predicted price is too low, the product will be bought quickly without the chance to adjust the price.

In other words the learning algorithm should predict slightly higher prices which can be decremented if necessary rather than underestimating the true price which will result in an immediate monetary loss.

## Question

How would you design an error metric incorporating this cost asymmetry?

## Possible Solution

A way to define an asymmetric loss function would be to simply multiply by a weight: $$\frac{1}{n} \sum_{i=1}^n \left| \alpha - \mathbb{1}_{(g(x_i) - \widehat{g}(x_i)) < 0} \right|\cdot \left(g(x_i) - \widehat{g}(x_i)\right)^2$$ with $\alpha \in (0,1)$ being the parameter we can adjust to change the degree of asymmetry. I've found it here. This seems like the most straight forward thing to do, while maintaining the quadratic loss.

• @MichaelChernick, FTR, I think this is a good question, which has been stated clearly & coherently, & acknowledge that I'm being a bit nit-picky. What I'm getting at is (as you know) fitting a regression (ie, solving for $\boldsymbol{\beta}$) is done (by default) by minimizing the OLS loss function, SSE. You're right that MSE could be used equivalently b/c dividing by a constant won't affect the ordering of candidate betas. Sep 25, 2012 at 15:56
• Another fact is that MSE (more often RMSE) is often used to assess the quality of a fitted model (although, again, SSE could be used equivalently). The thing is, this question seems (to me anyway) to be about how to think about / redesign the loss function, so that the fitted betas are different than they would have been by default, rather than about how to think differently about the quality of a model that has already been fit. Sep 25, 2012 at 15:59
• @Kiudee, if my interpretation of your Q is right, what would you think about editing it to add the loss-functions tag, & possibly revising the title to something like: "How to design & implement an asymmetric loss function for regression"? I won't make the edits myself in case you disagree w/ them. Sep 25, 2012 at 16:05
• For reference, I've seen quantile regression suggested when you want asymmetric loss functions, see Berk, 2011, PDF here. Sep 25, 2012 at 20:09
• As I'm using a variety of learning algorithms to tackle this problem, the function should be differentiable at least once. Sep 26, 2012 at 20:12