0
$\begingroup$

The mean absolute error (MAE) is defined as: $\frac{1}{n} \sum^n_{i=1} |e_i|$ where $e_i = y - y_{pred}$.

Now if I have two MAEs of $n$ and $N$ samples and take their average, this should be the same as the MAE over all $n+N$ samples:

$$\frac{\frac{1}{n} \sum^n_{i=1} |e_i|+\frac{1}{N} \sum^{n+N}_{i=n+1} |e_i|}{2} = \frac{1}{n+N} \sum^{n+N}_{i=1} |e_i|$$

Is this a correct assumption?

I tried to prove it, however, I didn't get very far.

Can someone show me how to show equality of the left and right-hand side?

$\endgroup$
  • 1
    $\begingroup$ The samples have to be equal ($n=N$) for equality to hold. $\endgroup$ – Paul Nov 1 '16 at 14:19
  • $\begingroup$ @Paul Ouch... thanks for pointing out the obvious to me =) $\endgroup$ – Dahlai Nov 1 '16 at 14:24
1
$\begingroup$

If the sizes of the two samples aren't equal, you should take a weighted average (assuming we're using the same prediction algorithm on each sample ) . Write $mae:=\frac1n\sum_1^n |e_i|$ and $MAE:=\frac1N\sum_1^N |e_i|$. Then $\sum_1^n|e_i|$ on the first sample is just $n(mae)$, and $\sum_1^N |e_i|$ on the second sample is $N(MAE)$, which means $$ {\sum_1^n|e_i| + \sum_1^N|e_i|\over n+N}= {n(mae) +N(MAE)\over n+N} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.