Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: tools/auto_bisect/math_utils.py

Issue 468633005: Quick spelling clean-up in the auto-bisect code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/auto_bisect/bisect_utils.py ('k') | tools/auto_bisect/source_control.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """General statistical or mathematical functions.""" 5 """General statistical or mathematical functions."""
6 6
7 import math 7 import math
8 8
9 9
10 def TruncatedMean(data_set, truncate_percent): 10 def TruncatedMean(data_set, truncate_percent):
11 """Calculates the truncated mean of a set of values. 11 """Calculates the truncated mean of a set of values.
12 12
13 Note that this isn't just the mean of the set of values with the highest 13 Note that this isn't just the mean of the set of values with the highest
14 and lowest values discarded; the non-discarded values are also weighted 14 and lowest values discarded; the non-discarded values are also weighted
15 differently depending how many values are discarded. 15 differently depending how many values are discarded.
16 16
17 Args: 17 Args:
18 data_set: Non-empty list of values. 18 data_set: Non-empty list of values.
19 truncate_percent: The % from the upper and lower portions of the data set 19 truncate_percent: How much of the upper and lower portions of the data set
20 to discard, expressed as a value in [0, 1]. 20 to discard, expressed as a value in [0, 1].
21 21
22 Returns: 22 Returns:
23 The truncated mean as a float. 23 The truncated mean as a float.
24 24
25 Raises: 25 Raises:
26 TypeError: The data set was empty after discarding values. 26 TypeError: The data set was empty after discarding values.
27 """ 27 """
28 if len(data_set) > 2: 28 if len(data_set) > 2:
29 data_set = sorted(data_set) 29 data_set = sorted(data_set)
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 124
125 # Redefining built-in 'StandardError' 125 # Redefining built-in 'StandardError'
126 # pylint: disable=W0622 126 # pylint: disable=W0622
127 def StandardError(values): 127 def StandardError(values):
128 """Calculates the standard error of a list of values.""" 128 """Calculates the standard error of a list of values."""
129 if len(values) <= 1: 129 if len(values) <= 1:
130 return 0.0 130 return 0.0
131 std_dev = StandardDeviation(values) 131 std_dev = StandardDeviation(values)
132 return std_dev / math.sqrt(len(values)) 132 return std_dev / math.sqrt(len(values))
OLDNEW
« no previous file with comments | « tools/auto_bisect/bisect_utils.py ('k') | tools/auto_bisect/source_control.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698