# Need to express curves as a set of gaussians, and compare two of these sets

I have two xy curves, defined numerically on a given (potentially different) range of x coordinates. What I need to do is to compare these two curves with the following strategy:

1. express each curve as a sum of unknown gaussian functions, to be determined.
2. compare the two sets of gaussians.
3. obtain a similarity score ranging from 0% (absolutely no similarity) to 100 % (they are the same).

I am not looking for exceedingly fancy algorithms for these tasks, but any hint and keywords to search for will certainly be welcome.

-
Are there some restrictions on the kind of curves you have? I think what you need is known in quantum mechanics as an overcomplete set of coherent states. But in QM, the states are usually complex wave functions. Another way to think about it is in terms of wavelets. –  Raskolnikov Sep 28 '11 at 19:09

1. Fix the number of Gaussians $n$ you consider. Then, perform an OLS estimation of the difference between the sum of the $n$ Gaussians and your observations: $$\min_{\alpha, \mu,\sigma}\;\sum_j\sum_{i=1}^n (\alpha_i\cdot\phi_{\mu_i,\sigma_i}(x_j)-y_j)^2.$$
2. Use a nonlinear optimization algorithm for this, e.g., the scipy package in Python. This gets you two sets of $(\alpha, \mu, \sigma)$, which you can compare.
3. For comparison, take again the sum of squared differences of the parameters, appropriately weighted, and apply $\exp(-\cdot)$ to map this into $(0, 1]$. However, other similarity mappings might be more appropriate for your application -- you might want to experiment here a bit.