Returns the geometric mean of a list of values. The mean is calculated using log to avoid overflow.
(values)
| 165 | |
| 166 | |
| 167 | def GeometricMean(values): |
| 168 | """Returns the geometric mean of a list of values. |
| 169 | |
| 170 | The mean is calculated using log to avoid overflow. |
| 171 | """ |
| 172 | values = list(map(float, values)) |
| 173 | return math.exp(sum(map(math.log, values)) / len(values)) |
| 174 | |
| 175 | |
| 176 | class ResultTracker(object): |
no test coverage detected