Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added median #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

added median #19

wants to merge 3 commits into from

Conversation

PirosB3
Copy link

@PirosB3 PirosB3 commented Jul 4, 2014

No description provided.

Copy link
Contributor

@acdha acdha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor changes

@@ -104,7 +104,7 @@ def run_benchmarks(control, experiment, benchmark_dir, benchmarks, trials,
control_data=control_data,
experiment_data=experiment_data,
)
print(format_benchmark_result(result, len(control_data.runtimes)))
print(format_benchmark_result(result, len(control_data.runtimes), control_data.runtimes, experiment_data.runtimes, show_median))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is getting pretty long - perhaps it'd be best to break it on the new trailing comma so it'd be easier to scan – maybe like this?

print(format_benchmark_result(result, len(control_data.runtimes),
                              control_data.runtimes, …

sorted_runs = sorted(runs)
middle = len(runs) / 2
if len(runs) % 2 == 0:
return sum(sorted_runs[middle-1:middle+1])/2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally find this a little easier to read with spaces around the operators

@@ -209,8 +216,7 @@ def insignificant(cls, text):
def bad(cls, text):
return cls.colorize(cls.BAD, text)


def format_benchmark_result(result, num_points):
def format_benchmark_result(result, num_points, control_data, experiment_data, show_median):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering whether show_median should be a keyword argument here as well - that list is getting a bit long but it's not too bad.

@acdha
Copy link
Contributor

acdha commented Nov 9, 2016

I left a couple of minor stylistic points above. A larger question: the basic part is whether we should use statistics.median on Python 3 (there appears to be a backport version on PyPI for Python 2), but I was also wondering whether we should be including something other than the median as well – either the variance or something like 50th & 95th percentile values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants