I need to find a similarity measurement between two arrays of data. You can call similarity measurement whatever you want, difference, correlation or whatever.
For example:
1, 2, 3, 4, 5 < Series 1
2, 3, 4, 5, 6 < Series 2
Should be far more similar to each other than these 2 series:
1, 2, 3, 4, 5 < Series 1
1, 1, 5, 8, 7 < Series 2
Any suggestions?
Is there a source code available for it?
Another way to do this is to calculate mutual information, there is a toolbox for this in matlab and C http://www.cs.man.ac.uk/~pococka4/MIToolbox.html
You can calculate the sample Pearson product-moment correlation coefficient: "The above formula suggests a convenient single-pass algorithm for calculating sample correlations". Write a loop to calculate sum(xi), sum(yi), sum(xi^2), sum(yi^2), and sum(xi*yi). Then insert these sums into the formula.
If your definition of similarity is how much same elements there are you can use set intersection: