1. Nicolas Saunier
  2. TrafficIntelligence


Nicolas Saunier  committed 0c86c73

median smoothing

  • Participants
  • Parent commits 47d9970
  • Branches default

Comments (0)

Files changed (1)

File python/utils.py

View file
         return 0.
+def medianSmoothing(x, X, Y, halfwidth):
+    '''Returns the media of Y's corresponding to X's in the interval [x-halfwidth, x+halfwidth]'''
+    from numpy import median
+    return median([y for observedx, y in zip(X,Y) if abs(x-observedx)<halfwidth])
 def argMaxDict(d):
     return max(d.iterkeys(), key=(lambda key: d[key]))