average of two mean absolute errors equals the mean absolute error over all points?

168 Views Asked by At

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?

1

There are 1 best solutions below

0
On BEST ANSWER

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} $$