Mercurial > hg > nsaunier > traffic-intelligence
comparison python/utils.py @ 282:abbd4bc13dac
modified indicator class (same interface)
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Fri, 21 Dec 2012 17:50:10 -0500 |
| parents | 4f012e3d881b |
| children | f2cf16ad798f |
comparison
equal
deleted
inserted
replaced
| 281:4f012e3d881b | 282:abbd4bc13dac |
|---|---|
| 164 ######################### | 164 ######################### |
| 165 # maths section | 165 # maths section |
| 166 ######################### | 166 ######################### |
| 167 | 167 |
| 168 def LCSS(l1, l2, threshold, distance): | 168 def LCSS(l1, l2, threshold, distance): |
| 169 "returns the longest common subsequence similarity | 169 """returns the longest common subsequence similarity |
| 170 based on the threshold on distance between two elements of lists l1, l2" | 170 based on the threshold on distance between two elements of lists l1, l2""" |
| 171 from numpy import zeros | 171 from numpy import zeros |
| 172 m = len(l1) | 172 m = len(l1) |
| 173 n = len(l2) | 173 n = len(l2) |
| 174 similarity = zeros((m+1,n+1)) | 174 similarity = zeros((m+1,n+1)) |
| 175 for i in xrange(1,m+1): | 175 for i in xrange(1,m+1): |
