Advertisement
Guest User

Untitled

a guest
Aug 5th, 2015
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #Returns the normalised correlation (a number that represents the similarity) between lists of y coordinates
  2.  
  3. #Note: ENSURE that and both lists are of identical length, delta x remains constant and x coordinate is common to both lists
  4.  
  5. import numpy as np
  6.  
  7. a = [0, 1, 0.5]
  8. b = [100, 1, 0.5]
  9.  
  10. output = np.correlate((a - np.mean(a)) / (np.std(a) * len(a)), (b - np.mean(b)) / np.std(b)) #Normalised correlation
  11.  
  12. print output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement