how to find the similarity between two curves and

2019-03-27 12:06发布

问题:

I have two data sets (t,y1) and (t,y2). These data sets visually look same but their is some time delay or magnitude shift. i want to find the similarity between the two curves (giving the score of similarity 1 for approximately similar curves and 0 for not similar curves). Some curves are seem to be different because of oscillation in data. so, i am searching for the method to find the similarity between the curves. i already tried gradient command in Matlab to find the slope of the curve at each time step and compared it. but it is not giving me satisfactory results. please anybody suggest me the method to find the similarity between the curves.

Thanks in Advance

回答1:

This answer assumes your y1 and y2 are signals rather than curves. The latter I would try to parametrise with POLYFIT.

If they really look the same, but are shifted in time (and not wrapped around) then you can:

y1n=y1/norm(y1);
y2n=y2/norm(y2);
normratio=norm(y1)/norm(y2);
c=conv2(y1n,y2n,'same');
[val ind]=max(c);

ind will indicate the time shift and normratio the difference in magnitude. Both can be used as features for your similarity metric. I assume however your signals actually vary by more than just timeshift or magnitude in which case some sort of signal parametrisation may be a better choice and then building a metric on those parameters.

Without knowing anything about your data I would first try with AR (assuming things as typical as FFT or PRINCOMP won't work).



回答2:

For time series data similarity measurement, one traditional solution is DTW (Dynamic Time Warpping)



回答3:

The dv and dc distance in the following paper may solve your problem. http://bioinformatics.oxfordjournals.org/content/27/22/3135.full



回答4:

  1. Kolmongrov Smirnov Test (kstest2 function in Matlab)
  2. Chi Square Test
  3. to measure similarity there is a measure called MIC: Maximal information coefficient. It quantifies the information shared between 2 data or curves.