Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Best way to optimize MAPE

The MAPE is a metric that can be used for regression problems :

$$\mbox{MAPE} = \frac{1}{n}\sum_{t=1}^n \left|\frac{A_t-F_t}{A_t}\right|$$

Where $A$ represents the actual value and $F$ the the forecast.

I have to optimize my models with respect to this metric. However, I am not sure of the best way to proceed. I could rewrite the objective function of my models (but most of the common libraries do not support custom objective functions) but this requires a lot of efforts.

Alternatively, I could use a transformation $f$ of the target, run the learning on the image $f(target)$ and return the prediction $f^{-1}(predicted)$.

I noticed that training the model, keeping the sum of squares metric, on $\log(target)$ and returning $\exp(predicted)$ resulted in a significant improvement.

Is there a way to know the best transform to use? Or should I cross validate over various transformations of the target?

Answer*

Cancel
2
  • $\begingroup$ Thank you so much for the detailed answers ! What is the -1-median ? I could not find informations about it... $\endgroup$ Commented May 27, 2016 at 8:49
  • $\begingroup$ That's quite understandable, it's not very common. I have edited my post to include a link to Gneiting (2011, JASA). It's discussed on page 752. $\endgroup$ Commented May 27, 2016 at 8:58