Method to define a error in a sensefull way

46 Views Asked by At

I have two functions $A(t)$ und $B(t)$ (given as a set of values) and I want to quantify how similar they are. In context: I want to check how good some approximation regarding the solution of an integro-differential equation is and it depends on some values $\gamma$. In order to compare the accuracy of this approximation, I want to compare the actual result with the approximation for different values of $\gamma$ in a given timeframe $T$. My approach was to use the maximal relative error, namely $\max_{t\in T}|\frac{A(t)-B(t)}{B(t)}|$, whereas $A(t)$ denotes the approximation and $B(t)$ is the actual solution.

However, it doesn't seem to be an appropriate way, as $B(t)$ as well as $A(t)$ become zero for some time $t\in T$, the relativ error explodes.

Is there any other error i could use to avoid this problem? As the range of $A(t)$ and $B(t)$ varies between one and minus one (most of the time), the absolute error wouldn't be a good method too....

Thanks already!

1

There are 1 best solutions below

2
On

Why not use a standard $2$-norm? If $A_t$ and $B_t$ are given as a set of discrete values with $t\in T$. Then the error, $\varepsilon$, can be computed as

$$ \varepsilon = \|A-B\|_{2} = \sqrt{\sum\limits_{t\in T} |A_t-B_t|^2}$$

I'm not exactly sure why you say that the absolute error wouldn't be a good method, but I hope this helps.

If you wish to have a "normalized" error measure, then you can either normalize with respect to the number of points, i.e. $$\varepsilon = \frac{1}{|T|} \|A-B\|_2$$ where $|T| = \sum_{t\in T}1$ is the number of points in the set $T$. Or you could normalize with respect to the total size of $A$ and $B$, i.e. $$\varepsilon = \frac{1}{\sum\limits_{t\in T}(|A_t|+|B_t|)} \|A-B\|_2.$$

There is no one "correct" way, it depends on the application. You can also try experimenting by replacing the $2$-norms above with max-norms (also known as $\infty$-norm) as you originally used, i.e. replace $\|\cdot\|_2$ with $$\|A-B\|_\infty = \max\limits_{t\in T}|A_t-B_t|.$$