Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to find the similarity between two curves and the score of similarity?

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

enter image description here

like image 856
user1364183 Avatar asked Apr 29 '12 14:04

user1364183


3 Answers

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).

like image 186
KiwiBarns Avatar answered Sep 26 '22 01:09

KiwiBarns


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

like image 42
xbob.ym Avatar answered Sep 26 '22 01:09

xbob.ym


  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.
like image 22
Arvind Kumar Avatar answered Sep 26 '22 01:09

Arvind Kumar