b

DiscoverSearch
About
My stuff
Mean Absolute Percentage Error for regression models
2016·arXiv
Abstract
Abstract

We study in this paper the consequences of using the Mean Absolute Percentage Error (MAPE) as a measure of quality for regression models. We prove the existence of an optimal MAPE model and we show the universal consistency of Empirical Risk Minimization based on the MAPE. We also show that finding the best model under the MAPE is equivalent to doing weighted Mean Absolute Error (MAE) regression, and we apply this weighting strategy to kernel regression. The behavior of the MAPE kernel regression is illustrated on simulated data.

Keywords: Mean Absolute Percentage Error; Empirical Risk Minimization;

Consistency; Optimization; Kernel Regression.

Classical regression models are obtained by choosing a model that minimizes an empirical estimation of the Mean Square Error (MSE). Other quality measures are used, in general for robustness reasons. This is the case of the Huber loss

image

for instance. Another example of regression quality measure is given by the Mean Absolute Percentage Error (MAPE). If x denotes the vector of explanatory variables (the input to the regression model), y denotes the target variable and g is a regression model, the MAPE of g is obtained by averaging the ratio |g(x)−y||y|

image

The MAPE is often used in practice because of its very intuitive interpretation in terms of relative error. The use of the MAPE is relevant in finance, for instance, as gains and losses are often measured in relative values. It is also useful to calibrate prices of products, since customers are sometimes more sensitive to

image

In real world applications, the MAPE is frequently used when the quantity to predict is known to remain way above zero. It was used for instance as the quality measure in a electricity consumption forecasting contest organized by GdF ecometering on datascience.net1. More generally, it has been argued that

image

where enough data are available, see e.g. [2].

We study in this paper the consequences of using the MAPE as the quality measure for regression models. Section 2 introduces our notations and the general context. It recalls the definition of the MAPE. Section 3 is dedicated to a first

image

optimal regression model with respect to the MSE is given by the regression function (i.e., the conditional expectation of the target variable knowing the explanatory variables). Section 3 shows that an optimal model can also be defined for the MAPE. Section 4 studies the consequences of replacing MSE/MAE by the

image

dimension. We show in particular that MAE based measures can be used to upper bound MAPE ones. Section 5 proves a universal consistency result for Empirical Risk Minimization applied to the MAPE, using results from Section 4. Finally, Section 6 shows how to perform MAPE regression in practice. It adapts

image

obtained model on simulated data.

We use in this paper a standard regression setting in which the data are fully described by a random pair Z = (X, Y ) with values in  Rd × R. We are interested in finding a good model for the pair, that is a (measurable) function g from  Rd to R such that g(X) is “close to” Y . In the classical regression setting, the closeness of g(X) to Y is measured via the  L2risk, also called the mean

squared error (MSE), defined by

image

In this definition, the expectation is computed by respect to the random pair (X, Y ) and might be denoted  EX,Y (g(X) − Y )2to make this point explicit.

image

settings.

Let m denote the regression function of the problem, that is the function

from  Rd to R given by

image

It is well known (see e.g. [3]) that the regression function is the best model in the case of the mean squared error in the sense that  L2(m) minimizes  L2(g) overthe set of all measurable functions from  Rd to R.

More generally, the quality of a model is measured via a loss function, l, from  R2 to R+. The point-wise loss of the model g is l(g(X), Y ) and the risk of

the model is

image

leads to the  LMSErisk defined above as  Ll2(g) = LMSE(g).

The optimal risk is the infimum of  Llover measurable functions, that is

image

where  M(Rd, R) denotes the set of measurable functions from  Rdto R. As

recalled above we have

image

As explained in the introduction, there are practical situations in which the L2risk is not a good way of measuring the closeness of g(X) to Y . We focus in this paper on the case of the mean absolute percentage error (MAPE) as an alternative to the MSE. Let us recall that the loss function associated to the

MAPE is given by

image

with the conventions that for all  a ̸= 0, a0 = ∞and that  00 = 1. Then the

MAPE-risk of model g is

image

Notice that according to Fubini’s theorem,  LMAP E(g) < ∞implies in particular that  E(|g(X)|) < ∞and thus that interesting models belong to  L1(PX), wherePXis the probability measure on  Rd induced by X.

We will also use in this paper the mean absolute error (MAE). It is based on the absolute error loss,  lMAE = l1 defined by lMAE(p, y) = |p − y|. As other

risks, the MAE-risk is given by

image

A natural theoretical question associated to the MAPE is whether an optimal model exists. More precisely, is there a function  mMAP Esuch that for all models

image

Obviously, we have

image

A natural strategy to study the existence of  mMAP Eis therefore to consider a point-wise approximation, i.e. to minimize the conditional expectation introduced above for each value of x. In other words, we want to solve, if possible, the

optimization problem

image

for all values of x.

image

introduce necessary and sufficient conditions for the problem to involve finite values, then we show that under those conditions, it has at least one global solution for each x and finally we introduce a simple rule to select one of the solutions.

3.1. Finite values for the point-wise problem60

To simplify the analysis, let us introduce a real valued random variable T

and study the optimization problem

image

Depending on the distribution of T and of the value of  m, J(m) = E�|m−T ||T | �isnot always a finite value, excepted for m = 0. In this latter case, for any random variable T, J(0) = 1 using the above convention.

Let us consider an example demonstrating problems that might arise for m ̸= 0. Let Tbe distributed according to the uniform distribution on [−1,1].

Then

image

If  m ∈]0,1], we have

image

This example shows that when T is likely to take values close to 0, then  J(m) = ∞

image

when 1|T | as a finite expectation, that is when the probability that |T| is smaller than  ϵdecreases sufficiently quickly when  ϵgoes to zero.

More formally, we have the following proposition.

Proposition 1. J(m) < ∞ for all mif and only if

image

If any of those conditions is not fulfilled, then  J(m) = ∞ for all m ̸= 0.

Proof. We have

image

If P(T = 0) > 0 then for all  m ̸= 0, J(m) = ∞. Let us therefore consider the case P(T = 0) = 0. We assume m > 0, the case m < 0 is completely identical.

We have

image

A simple upper bounding gives

image

and symmetrically

image

This shows that J(m) is the sum of finite terms and of  mE� IT ∈]0,m]−IT ∈[−m,0[T �.Because of the symmetry of the problem, we can focus on  E� IT ∈]0,m]T �. It is also obvious that  E� IT ∈]0,m]T �is finite if and only if  E� IT ∈]0,1]T �is finite.

image

more operational conditions in the rest of the proof.

Let us therefore introduce the following functions:

image

We have obviously for all  x ∈]0, 1], g−(x) ≤ 1x ≤ g+(x). In addition

image

According to the monotone convergence theorem,

image

E(g−(T)) are finite, or both are infinite. In addition, we have

image

therefore  E� IT ∈]0,1]T �is finite if and only if  E(g−(T)) is finite. So a sufficient and necessary condition for  E� IT ∈]0,1]T �to be finite is

image

A symmetric derivation shows that  E�−IT ∈]−1,0]T �is finite if and only if

image

The conditions of Proposition 1 can be used to characterize whether  P(T ∈]0, ϵ]) decreases sufficiently quickly to ensure that J is not (almost) identically

equal to +∞. For instance, if  P(T ∈]0, ϵ]) = ϵ, then

image

and the sum diverges, leading to  J(m) = ∞(for  m ̸= 0). On the contrary, if

P(T ∈]0, ϵ]) = ϵ2, then

image

and thus the sum converges, leading to  J(m) < ∞for all m (provided similar

image

3.2. Existence of a solution for the point-wise problem

If the conditions of Proposition 1 are not fulfilled, J(m) is infinite excepted in m = 0 and therefore arg minm∈R J(m) = 0. When they are fulfilled, we have toshow that J(m) has at least one global minimum. This is done in the following

image

Proposition 2. Under the conditions of Proposition 1, J is convex and has at least one global minimum.

Proof. We first note that J is convex. Indeed for all  t ̸= 0, m �→ |m−t||t|is obviously convex. Then the linearity of the expectation allows to conclude

image

As  P(T = 0) = 0, there is [a, b], a < b such that P(T ∈ [a, b]) >0 with either a > 0 or b < 0. Let us assume a > 0, the other case being symmetric. Then for

image

Then

image

and therefore limm→+∞ J(m) = +∞.

Similarly, if  m < 0 < a, then for t ∈ [a, b]

image

and then

image

and therefore limm→−∞ J(m) = +∞.

Therefore, J is a coercive function and has at least a local minimum, which is global by convexity.

3.3. Choosing the minimum95

However, the minimum is not necessary unique, as J is not strictly convex. In general, the set of global minima will be a bounded interval of R. In this case, and by convention, we consider the mean value of the interval as the optimal solution.

As an example of such behavior, we can consider the case where T is a random variable on {1, 2, 3}, such that P(T = 1) = 0.3, P(T = 2) = 0.4 and

P(T = 3) = 0.3. Then the expected loss is

image

and the figure 1 illustrates that there is an infinity of solutions. Indeed when

m ∈ [1, 2], J becomes

image

More generally, for any random variable T, we have defined a unique value m, which is a global minimum of  J(m) = E��� m−TT ���. Moving back to our problem, it ensures that the MAPE-regression function  mMAP Eintroduced in 8 is well defined and takes finite values on  Rd. As  mMAP Eis point-wise optimal, it is

image

image

Figure 1: Counterexample with an infinite number of solutions.

One of the most standard learning strategy is the Empirical Risk Minimization (ERM) principle. We assume given a training set  Dn = (Zi)1≤i≤N =(Xi, Yi)1≤i≤nwhich consists in n i.i.d. copies of the random pair Z = (X, Y ).

image

from  Rd to R. Given a loss function l, we denote  L∗l,G = infg∈G Ll(g).

The empirical estimate of  Ll(g) (called the empirical risk) is given by

image

Then the ERM principle consists in choosing in the class G the model that

minimizes the empirical risk, that is

image

The main theoretical question associated to the ERM principle is how to control Ll(�gl,Dn,G) in such a way that it converges to  L∗l,G. An extension of this question

is whether  L∗l can be reached if G is allowed to depend on n: the ERM is said to

image

for any distribution of (X, Y ) (see Section 5).

It is well known (see e.g. [3] chapter 9) that ERM consistency is related to uniform laws of large numbers (ULLN). In particular, we need to control

quantities of the following form

image

This can be done via covering numbers or via the Vapnik-Chervonenkis dimension (VC-dim) of certain classes of functions derived from G. One might think that general results about arbitrary loss functions can be used to handle the case

image

Lipschitz property of l (see Lemma 17.6 in [4], for instance) that is not fulfilled by the MAPE.

The objective of this section is to analyze the effects over covering numbers (Section 4.2) and VC-dimension (Section 4.3) of using the MAPE as the loss

image

those analyses (Section 4.4).

4.1. Classes of functions

Given a class of models, G, and a loss function l, we introduce derived classes,

H(G, l) given by

image

and  H+(G, l) given by

image

4.2. Covering numbers

4.2.1. Notations and definitions

Let F be a class of positive functions from an arbitrary set Z to  R+. The

supremum norm on F is given by

image

We also define  ∥F∥∞ = supf∈F ∥f∥∞. We have obviously

image

only in  R+), hence the absolute value.

Let  κbe a dissimilarity on F, that is a positive and symmetric function from  F 2to  R+that measures how two functions from F are dissimilar (in particular  κ(f, f) = 0). Then κcan be used to characterize the complexity of F

image

Definition 1. Let F be a class of positive functions from Z to  R+and  κa dissimilarity on  F. For ϵ > 0 and pa positive integer, a size  p ϵ-cover of F withrespect to  κis a finite collection  f1, . . . , fpof elements of F such that for all

f  ∈ F

image

Then the  κ ϵ-covering number of F is defined as follow.

Definition 2. Let F be a class of positive functions from Z to  R+, κbe a dissimilarity on F and  ϵ >0. Then the  κ ϵ-covering number of  F, N(ϵ, F, κ), is the size of the smallest  κ ϵ-cover of F. If such a cover does not exists, the

image

The behavior of  N(ϵ, F, κ) with respect to  ϵcharacterizes the complexity of F as seen through  κ. If the growth when  ϵ →0 is slow enough (for an adapted choice of  κ), then some uniform law of large numbers applies (see Lemma 1).

4.2.2. Supremum covering numbers

Supremum covering numbers are based on the supremum norm, that is

image

For classical loss functions, the supremum norm is generally ill-defined on H(G, l). For instance let  h1 and h2be two functions from  H(G, l2), generated by  g1 and

g2 (that is hi(x, y) = (gi(x) − y)2). Then

image

and a value of  x such that g1(x) ̸= g2(x). Then supy |h1(x, y) − h2(x, y)| = ∞.

A similar situation arises for the MAPE. Indeed, let  h1 and h2be two functions from  HMAP E, generated by  g1 and g2 in G (that is hi(x, y) = |gi(x)−y||y| ). Then

image

Thus unless G is very restricted there is always  x, g1 and g2 such that g1(x) ̸= 0and  |g2(x)| ̸= |g1(x)|. Then for y > 0, ||g1(x) − y| − |g2(x) − y||has the general form  α + βy with α >0 and thus limy→0+||g1(x)−y|−|g2(x)−y|||y| = +∞.

image

definition to a subset of Z. This corresponds in practice to support assumptions on the data (X, Y ). Hypotheses on G are also needed in general. In this latter case, one generally assumes  ∥G∥∞ < ∞. In the former case, assumptions depends on the nature of the loss function.

For instance in the case of the MSE, it is natural to assume that |Y | is upper

bounded by YUwith probability one. If (x, y) ∈ Rd × [−YU, YU] then

image

In the case of the MAPE, a natural hypothesis is that |Y | is lower bounded

by  YL(almost surely). If (x, y) ∈ Rd × (] − ∞, −YL] ∪ [YL, ∞[), then

image

and therefore the supremum norm is well defined.

The case of the MAE is slightly different. Indeed when x is fixed, then for sufficiently large positive values of  y, ||g1(x) − y| − |g2(x) − y|| = |g1(x) − g2(x)|.Similarly, for sufficient large negative values of  y, ||g1(x) − y| − |g2(x) − y|| =

image

∥G∥∞ < ∞. In addition, we have the following proposition.

Proposition 3. Let G be an arbitrary class of models with  ∥G∥ < ∞and let

YL > 0. Let ∥.∥YL∞ denote the supremum norm on  H(G, lMAP E) defined by2

image

Let  ϵ > 0, then

image

Proof. Let  ϵ >0 and let  h′1, . . . , h′kbe a minimal  ϵYLcover of  H(G, lMAE) (thus  k = N(ϵYL, H(G, lMAE), ∥.∥∞)). Let  g1, . . . , gkbe the functions from G associated to  h′1, . . . , h′kand let  h1, . . . , hkbe the corresponding functions in

image

Indeed let h be an arbitrary element of  H(G, lMAP E) associated  g and let h′ bethe corresponding function in  H(G, lMAE). Then for a given  j, ∥h′−h′j∥∞ ≤ ϵYL.

We have then

image

For all  y ∈] − ∞, −YL] ∪ [YL, ∞[, 1|y| ≤ 1YL and thus

image

Then

image

and thus

image

which allows to conclude.

This Proposition shows that the covering numbers associated to a class of functions G under the MAPE are related to the covering numbers of the same class under the MAE, as long as Y stays away from too small values.

4.2.3. Lp covering numbers170

Lpcovering numbers are based on a data dependent norm. Based on the training set  Dn, we define for  p ≥ 1 :

image

We have a simple proposition:

Proposition 4. Let G be an arbitrary class of models and  Dna data set such

that  ∀i, Yi ̸= 0, then for all  p ≥ 1,

image

Proof. The proof is similar to the one of Proposition 3.

This Proposition is the adaptation of Proposition 3 to  Lpcovering numbers.

4.3. VC-dimension

image

dimension (VC dimension). We recall first the definition of the shattering coeffi-cients of a function class.

Definition 3. Let F be a class of functions from  Rd to {0, 1} and nbe a positive

integer. Let  {z1, . . . , zn}be a set of  n points of Rd. Let

image

that is the number of different binary vectors of size n that are generated by functions of F when they are applied to  {z1, . . . , zn}.

image

Then the VC-dimension is defined as follows.

Definition 4. Let F be a class of functions from  Rd to {0, 1}. The VC-dimension

of F is defined by

image

Interestingly, replacing the MAE by the MAPE does not increase the VC-dim of the relevant class of functions.

Proposition 5. Let G be an arbitrary class of models. We have

image

Proof. Let us consider a set of k points shattered by  H+(G, lMAP E), (v1, . . . , vk),

image

function  hθ ∈ H(G, lMAP E) such that  ∀j, It≤hθ(x,y)(xj, yj, tj) = θj. Each  hθcorresponds to a  gθ ∈ G, with hθ(x, y) = |gθ(x)−y||y| .

We define a new set of k points, (w1, . . . , wk) as follows. If  yj ̸= 0, then

wj = (xj, yj, |yj|tj). For those points and for any  g ∈ G,

image

y|.

image

gθ(xj) = 0 and hθ(xj, 0) = ∞ if gθ(xj) ̸= 0. As the set of points is shattered tj >1 (or  hθ(xj, 0) < tjwill never be possible). In addition when  θj = 1 then gθ(xj) ≥0 and when  θj = 0 then gθ(xj) = 0. Then let wj = (xj, 0, minθ,θj=1 |gθ(xj)|). Notice that minθ,θj=1 |gθ(xj)| >0 (as there is a finite number of binary vectors

image

and thus  h′θ(xj, yj) < minθ,θj=1 |gθ(xj)|, that is  It≤h′θ(x,y)(wj) = 0 = θj. For  θsuch that  θj = 1, h′θ(xj, yj) = |gθ(xj)|and thus  h′θ(xj, yj) ≥ minθ,θj=1 |gθ(xj)|. Then  It≤h′θ(x,y)(wj) = 1 = θj.

This shows that for each binary vector  θ ∈ {0, 1}k, there is a function

image

shattered by  H+(G, lMAE).

Therefore  V Cdim(H+(G, lMAE)) ≥ k. If V Cdim(H+(G, lMAP E)) < ∞, thenwe can take  k = V Cdim(H+(G, lMAP E)) to get the conclusion.

If  V Cdim(H+(G, lMAP E)) = ∞then k can be chosen arbitrarily large and

image

Using theorem 9.4 from [3], we can bound the  Lpcovering number with a VC-dim based value. If  V Cdim(H+(G, l)) ≥2,  p ≥1, and 0  < ϵ < ∥H(G,l)∥∞4,

then

image

Therefore, in practice, both the covering numbers and the VC-dimension of MAPE based classes can be derived from the VC-dimension of MAE based classes.

4.4. Examples of Uniform Laws of Large Numbers

image

Rephrased with our notations, Lemme 9.1 from [3] is

Lemma 1 (Lemma 9.1 from [3]). For all n, let Fnbe a class of functions from

Z to [0, B] and let ϵ > 0. Then

image

image

for all  ϵ, then

image

A direct application of Lemma 1 to H(G, l) gives

image

provided the support of the supremum norm coincides with the support of (X, Y ) and functions in H(G, l) are bounded.

In order to fulfill this latter condition, we have to resort on the same strategy

image

As in Section 4.2.2 let  ∥G∥∞ < ∞and let  YU < ∞be such that  |Y | ≤ YU

almost surely, then

image

and

image

Then if  B ≥ ∥G∥2∞+Y 2U (resp. B ≥ ∥G∥∞+YU), Lemma 1 applies to  H(G, lMSE)(resp. to  H(G, lMAE)).

Similar results can be obtained for the MAPE. Indeed let us assume that

|Y | ≥ YL >0 almost surely. Then if  ∥G∥∞ is finite,

image

This discussion shows that  YL, the lower bound on |Y |, plays a very similar

image

MAE and the MSE. A very similar analysis can be made when using the  Lpcovering numbers, on the basis of Theorem 9.1 from [3]. It can also be combined with the results obtained on the VC-dimension. Rephrased with our notations,

Theorem 9.1 from [3] is

Theorem 1 (Theorem 9.1 from [3]). Let F be a class of functions from Z to

[0, B]. Then for ϵ > 0 and n > 0

image

As for Lemma 1, we bound  ∥H(G, l)∥∞via assumptions on G and on Y . For

instance for the MAE, we have

image

and for the MAPE

image

Equation (20) can be combined with results from Propositions 4 or 5 to allow a comparison between the MAE and the MAPE. For instance, using the VCdimension results, the right hand side of equation (19) is bounded above by

24�2e(∥G∥∞ + YU)pϵp log 3e(∥G∥∞ + YU))pϵp

image

while the right hand side of equation (20) is bounded above by

image

In order to obtain almost sure uniform convergence of �Ll(g, Dn) to Ll(g) over G,those right hand side quantities must be summable (this allows one to apply the Borel-Cantelli Lemma). For fixed values of the VC dimension, of  ∥G∥∞, YL andYUthis is always the case. If those quantities are allowed to depend on n, then

image

play symmetric roles for the MAE and the MAPE. Indeed for the MAE, a fast growth of  YUwith n might prevent the bounds to be summable. For instance, if  YUgrows faster than √n, then n(∥G∥∞+YU)2does not converges to zero and the series is not summable. Similarly, if  YLconverges too quickly to zero, for

image

summable. The following Section goes into more details about those conditions in the case of the MAPE.

We show in this section that one can build on the ERM principle a strongly

image

almost universal).

Theorem 2. Let Z = (X, Y ) be a random pair taking values in  Rd × Rsuch that  |Y | ≥ YL >0 almost surely (YLis a fixed real number). Let (Zn)n≥1 =(Xn, Yn)n≥1be a series of independent copies of Z.

image

such that:

1. Gn ⊂ Gn+1;

2. �n≥1 Gnis dense in the set of  L1(µ) functions from  Rdto R for any

image

If in addition

image

and there is  δ > 0 such that

image

then  LMAP E(�glMAP E,Gn,Dn)converges almost surely to  L∗MAP E.

Proof. We use the standard decomposition between estimation error and approx-

imation error. More precisely, for  g ∈ G, a class of functions,

image

We handle first the approximation error. As pointed out in Section 2,  LMAP E(g) <∞implies that  g ∈ L1(PX). Therefore we can assume there is a series (g∗k)k≥1

of functions from  L1(PX) such that

image

by definition of  L∗MAP E as an infimum.

Let us consider two models  g1 and g2. For arbitrary x and y, we have

image

and thus

image

and therefore

image

and thus

image

image

This shows that limn→∞ L∗MAP E,Gn = L∗MAP E.

The estimation error is handled via the complexity control techniques studied

in the previous Section. Indeed, according to Theorem 1, we have (for p = 1)

image

with

image

D(n, ϵ) ≤ 24�2e(1 + ∥Gn∥∞)pϵYL log 3e(1 + ∥Gn∥∞))ϵYL

Using the fact that log(x) ≤ x, we have

image

and

image

As limn→∞Vn∥Gn∥2∞ log ∥Gn∥∞n = 0,

image

As limn→∞ n1−δ∥Gn∥2∞ = ∞,

image

Therefore, for n sufficiently large,  D(n, ϵ) is dominated by a term of the form

image

with  α >0 and  β >0 (both depending on  ϵ). This allows to conclude that �n≥1 D(n, ϵ) < ∞. Then the Borel-Cantelli theorem implies that

image

The final part of the estimation error is handled in a traditional way. Let  ϵ > 0.

There is  N such that n ≥ N implies

image

Then �LMAP E(g, Dn) ≤ LMAP E(g) + ϵ. By definition

image

and thus for all g,

image

By taking the infimum on  Gn, we have therefore

image

Applying again the hypothesis,

image

and therefore

image

As a consequence

image

The combination of this result with the approximation result allows us to conclude.

Notice that several aspects of this proof are specific to the MAPE. This is the

image

This is also the case of the estimation part which uses results from Section 4 that are specific to the MAPE.

The previous Sections have been dedicated to the analysis of the theoretical

image

MAPE regression and we compare it to MSE/MAE regression.

On a practical point of view, building a MAPE regression model consists in minimizing the empirical estimate of the MAPE over a class of models  Gn, that

is to solve

image

where the (xi, yi)1≤i≤nare the realizations of the random variables (Xi, Yi)1≤i≤n.

Optimization wise, this is simply a particular case of median regression (which is in turn a particular case of quantile regression). Indeed, the quotient

image

implementation that supports instance weights can be used to find the optimal model. This is for example the case of quantreg R package [5], among others. Notice that when  Gncorresponds to linear models, the optimization problem is a simple linear programming problem that can be solved by e.g. interior point

image

For some complex models, instance weighting is not immediate. As an example of MAPE-ing a classical model we show in this section how to turn kernel quantile regression into kernel MAPE regression. Notice that kernel regression introduces regularization and thus is not a direct form of ERM.

image

6.1. From quantile regression to MAPE regression

6.1.1. Quantile regression

Let us assume given a Reproducing Kernel Hilbert Space (RKHS), H, of functions from  Rd to R(notice that  Rd could be replaced by an arbitrary space

image

and  H, φ. As always, we have  k(x, x′) = ⟨φ(x), φ(x′)⟩.

The standard way of building regression models based on a RKHS consists in optimizing a regularized version of an empirical loss, i.e., in solving an

optimization problem of the form

image

Notice that the reproducing property of H implies that there is  w ∈ H such that

f(x) = ⟨w, φ(x)⟩.

In particular, quantile regression can be kernelized via an appropriate choice for l. Indeed, let  τ ∈[0; 1] and let  ρτ be the check-function, introduced in [7]:

image

The check-function is also called the pinball loss. Then, the kernel quantile optimization problem, treated in [8, 9], is defined by:

image

where  λ >0 handles the trade-off between the data fitting term and the regular-

image

6.2. MAPE primal problem

To consider the case of the MAPE, one can change the equation (24) to (25):

image

Notice that for the sake of generality, we do not specify the value of  τin this derivation: thus equation (25) can be seen as a form of “relative quantile”.

image

standard MAPE, that is to  τ = 12. The practical relevance of the “relative quantile” remains to be assessed.

Using the standard way of handling absolute values and using f(x) = ⟨φ(x), w⟩, we can rewrite the regularization problem (25) as a (primal) op-

image

where  C = 1nλ.

6.2.1. MAPE dual problem

Let us denote  θ = (w, b, ξ, ξ⋆) the vector regrouping all the variables of the primal problem. We denote in addition:

image

image

max

image

where the  ui,kare the Lagrange multipliers. Some algebraic manipulations show that problem (27) is equivalent to problem (28):

image

We can simplify the problem by introducing a new parametrisation via the variables  αi = ui,1 − ui,2. Then the value of w is obtained from constraint (29) as  w = �ni=1 αiφ(xi). Constraints (30) can be rewritten into 1T α = 0. Taking

those equations into account, the objective function becomes

image

Using constraints (31) and (32), the last two terms simplify as follows:

image

and thus the objective function is given by

image

where  Kij = k(xi, xj) is the kernel matrix. This shows that the objective function can be rewritten so as to depend only on the new variables  αi. The last step of

image

The cases of constraints (29) and (30) have already been handled.

Notice that given an arbitrary  αi, there is always  ui,1 ≥ 0 and ui,2 ≥ 0 suchthat  αi = ui,1 − ui,2. However, constraints (31) and (32) combined with  ui,3 ≥ 0and  ui,4 ≥0 show that  ui,1and  ui,2(and thus  αi) cannot be arbitrary, as we

image

αi ≤ Cτ|yi|2 . As ui,1 ≥ 0, −αi ≤ ui,2 and thus αi ≥ C(1−τ)|yi|2. Conversely, it is easy to see that if  αisatisfies the constraints C(τ−1)|yi|2 ≤ αi ≤ Cτ|yi|2, then there is  ui,kfor k = 1, . . . , 4 such that  αi = ui,1 − ui,2and such that the constraints (31), (32) and (33) are satisfied (take  ui,1 = max(0, αi) and ui,2 = max(0, −αi)).

image

6.2.2. Comparaison to the quantile regression

In the case of quantile regression, [8] shows that the dual problem is equivalent

to

image

In comparison to problem (34), one can remark that the modification of the

image

primal optimization problem is equivalent to changing the set of optimization in the dual optimization problem. More precisely, it is equivalent to reducing (resp. increasing) the “size” of the optimization set of  αi if yi > 1 (resp. yi < 1).

Thus, the smaller is  yi, the larger is the optimization set of  αi. This permits

image

error is potentially bigger). Moreover, by choosing a very large value of C (or C → ∞), one can ensure the same optimal value of each  αiin MAE and MAPE dual problems. This surprising fact can be explained by noticing that a very large value of C corresponds to a very small value of  λ (or λ → 0). When λ goes

image

potential overfitting. When this overfitting appears,  f(xi) ≃ yiregardless of the loss function and thus the different loss functions are equivalent.

6.3. A simulation study

6.3.1. Generation of observations

image

described in section 6.1 on simulated data, and we compare the results to the ones obtained by kernel median regression. Experiments have been realized using a Gaussian kernel.

As in [8], we have simulated data according to the sinus cardinal function,

defined by

image

However, to illustrate the variation of the prediction according the proximity to zero, we add a parameter a and we define the translated sinus cardinal function by:

image

For experiments, we have generated 1000 points to constitute a training set, and 1000 other points to constitute a test set. As in [8], the generation process is the following:

image

with  X ∼ U([−∞; ∞]) and ϵ(X) ∼ N�0, (0.1 · exp(1 − X))2�

image

estimation, we have computed �fMAP E,a and �fMAE,afor several values of a. The value of the regularization parameter C is chosen via a 5-fold cross-validation.

6.3.2. Results

image

Table 1: Summary of the experimental results: for each value of the translation parameter a, the table gives the MAPE of �fMAP E,a and �fMAE,aestimated on the test set. The table also reports the value of the regularization parameter C for both loss function.

Results of experiments are described in the table 1. As expected, in most

image

especially the case when values of y are close to zero.

6.3.3. Graphical illustration

Some graphical representations of �fMAP E,a and �fMAE,aare given on Figure 2. This Figure illustrates several interesting points:

image

image

Up to translation, �fMAE,alooks roughly the same for each a, whereas

image

Red curves are closer to 0 than blue curves. One can actually show that,

image

The red curve seems to converge toward the blue one for high values of a.

We have shown that learning under the Mean Absolute Percentage Error

image

particularly, we have shown the existence of an optimal model regarding to the MAPE and the consistency of the Empirical Risk Minimization. Experimental results on simulated data illustrate the efficiency of our approach to minimize the MAPE through kernel regressions, what also ensures its efficiency in application

image

is positive by design and remains quite far away from zero, e.g. in price prediction for expensive goods). Two open theoretical questions can be formulated from this work. A first question is whether the lower bound hypothesis on |Y | can be lifted: in the case of MSE based regression, the upper bound hypothesis on

image

cannot be adapted immediately to the MAPE because of the importance of the lower bound on |Y | in the approximation part of Theorem 2. A second question is whether the case of empirical regularized risk minimization can be shown to be consistent in the case of the MAPE.

image

Figure 2: Representation of estimation: �fMAE,ain blue and �fMAP E,a in red.

The authors thank the anonymous reviewers for their valuable comments that helped improving this paper.

image

Mathematical Statistics 35 (1) (1964) 73–101.

[2] J. S. Armstrong, F. Collopy, Error measures for generalizing about forecasting

image

(1992) 69 – 80.

image

Nonparametric Regression, Springer, New York, 2002.

[4] M. Anthony, P. L. Bartlett, Neural Network Learning: Theoretical Founda-

tions, Cambridge University Press, 1999.

[5] R. Koenker, quantreg: Quantile regression. r package version 5.05 (2013).

image

2004.

[7] R. Koenker, G. Bassett Jr, Regression quantiles, Econometrica: journal of

the Econometric Society (1978) 33–50.

[8] I. Takeuchi, Q. V. Le, T. D. Sears, A. J. Smola, Nonparametric quantile

image

[9] Y. Li, Y. Liu, J. Zhu, Quantile regression in reproducing kernel hilbert spaces,

Journal of the American Statistical Association 102 (477) (2007) 255–268.


Designed for Accessibility and to further Open Science