Mercurial Hosting > traffic-intelligence
comparison python/indicators.py @ 370:97e8fa0ee9a1
work in progress for complete alignment
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Mon, 15 Jul 2013 18:18:44 -0400 |
parents | 027e254f0b53 |
children | 2ea8584aa80a |
comparison
equal
deleted
inserted
replaced
369:027e254f0b53 | 370:97e8fa0ee9a1 |
---|---|
108 class LCSS(utilsLCSS): | 108 class LCSS(utilsLCSS): |
109 '''Adapted LCSS class for indicators, same pattern''' | 109 '''Adapted LCSS class for indicators, same pattern''' |
110 def __init__(self, threshold, delta = float('inf'), aligned = False, lengthFunc = min): | 110 def __init__(self, threshold, delta = float('inf'), aligned = False, lengthFunc = min): |
111 utilsLCSS.__init__(self, lambda x,y: (distanceForLCSS(x,y) <= threshold), delta, aligned, lengthFunc) | 111 utilsLCSS.__init__(self, lambda x,y: (distanceForLCSS(x,y) <= threshold), delta, aligned, lengthFunc) |
112 | 112 |
113 def get(self, indicator1, indicator2): | 113 def compute(self, indicator1, indicator2): |
114 if indicator1 and indicator2: | 114 if indicator1 and indicator2: |
115 return self.compute(indicator1.getValues(), indicator2.getValues()) | 115 return self._compute(indicator1.getValues(), indicator2.getValues()) |
116 else: | 116 else: |
117 return 0 | 117 return 0 |
118 | 118 |
119 def getNormalized(self, indicator1, indicator2): | 119 def computeNormalized(self, indicator1, indicator2): |
120 if indicator1 and indicator2: | 120 if indicator1 and indicator2: |
121 return self.computeNormalized(indicator1.getValues(), indicator2.getValues()) | 121 return self._computeNormalized(indicator1.getValues(), indicator2.getValues()) |
122 else: | 122 else: |
123 return 0. | 123 return 0. |
124 | 124 |
125 def getDistance(self, indicator1, indicator2): | 125 def computeDistance(self, indicator1, indicator2): |
126 if indicator1 and indicator2: | 126 if indicator1 and indicator2: |
127 return self.computeDistance(indicator1.getValues(), indicator2.getValues()) | 127 return self._computeDistance(indicator1.getValues(), indicator2.getValues()) |
128 else: | 128 else: |
129 return 1. | 129 return 1. |
130 | 130 |
131 | 131 |
132 class SeverityIndicator(TemporalIndicator): | 132 class SeverityIndicator(TemporalIndicator): |