Metric to compare function similarity

110 Views Asked by At

I have 3 functions (built by x,y values: CSV file link).

Three mathematical functions

The red one is a baseline function. The green and blue ones are approximated versions of the red ones. It is clear that the green one is much more similar to the red one and the blue one is a very aggressive function with many overshoots.

I want to find a metric that will show that. So, the similarity score between green and red will be higher than between blue and red so this metric will show the aggressiveness.

Both green and blue are slightly above the red one, so if I use RMS, the similarity of the blue and green to the red one is the same, and it doesn't reflect the overshoot aggressiveness.

Which metric can I use to evaluate the functions' similarity to the baseline function?

2

There are 2 best solutions below

1
On

Following your comment, maybe you can try the Kolmogorov-Smirnov test-based criteria, i.e.,

$$ D = \sup_x| F_{1, n}(x) - F_{2, n}(x)|. $$

0
On

I am not sure to well understand the problem. Nevertheless I post below a few tests. Hoping that will help.

From data : Red y0(x)=Baseline ; Blue y1(x)=funct1 ; Green y2(x)=funct2 ; Brown y3(x)=func3 :

enter image description here

Difference between each function and the Baseline : Blue (y1-y0) ; Green (y2-y0) ; Brown (y3-y0) :

enter image description here

Visually it is obvious that the difference is lower for funct2 than for func1 and the difference is much higher for funct3.

Probably they are many manners to characterize numerically the above difference with an even function which is equat to zero when the difference is zero. A few examples below.

enter image description here

The case c=2 corresponds to the Root Mean Square difference.

Other functions f(epsilon) can be chosen depending on what is expected.