Last active
August 29, 2015 14:25
-
-
Save clungzta/98f453f6aafd2b69643b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Returns the normalised correlation (a number that represents the similarity) between lists of y coordinates | |
#Note: ENSURE that and both lists are of identical length, delta x remains constant and x coordinate is common to both lists | |
import numpy as np | |
a = [0, 1, 0.5] | |
b = [100, 1, 0.5] | |
output = np.correlate((a - np.mean(a)) / (np.std(a) * len(a)), (b - np.mean(b)) / np.std(b)) #Normalised correlation | |
print output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment