Created
May 10, 2019 11:36
-
-
Save masak/30d37a594964b905a21f956281535084 to your computer and use it in GitHub Desktop.
Playing around with generating data for box plots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat stat | |
a249ded 68.390 | |
a249ded 67.585 | |
a249ded 66.976 | |
a249ded 67.658 | |
a249ded 66.592 | |
a249ded 68.217 | |
a249ded 67.328 | |
a249ded 66.319 | |
a249ded 68.024 | |
a249ded 62.978 | |
a249ded 53.715 | |
a249ded 53.436 | |
a249ded 53.763 | |
a249ded 52.619 | |
a249ded 64.110 | |
a249ded 58.358 | |
a249ded 56.738 | |
a249ded 58.365 | |
a249ded 60.563 | |
a249ded 56.834 | |
c32784d 62.001 | |
c32784d 59.924 | |
c32784d 57.209 | |
c32784d 56.531 | |
c32784d 60.298 | |
c32784d 54.366 | |
c32784d 57.626 | |
c32784d 62.442 | |
c32784d 58.239 | |
c32784d 57.061 | |
c32784d 56.417 | |
c32784d 56.089 | |
c32784d 55.367 | |
c32784d 54.292 | |
c32784d 55.008 | |
c32784d 56.064 | |
c32784d 54.491 | |
c32784d 53.877 | |
c32784d 58.001 | |
c32784d 58.693 | |
16a6395 58.939 | |
16a6395 58.052 | |
16a6395 53.540 | |
16a6395 54.117 | |
16a6395 54.845 | |
16a6395 60.075 | |
16a6395 68.659 | |
16a6395 57.152 | |
16a6395 55.849 | |
16a6395 55.320 | |
16a6395 53.772 | |
16a6395 53.642 | |
16a6395 54.285 | |
16a6395 53.163 | |
16a6395 52.613 | |
16a6395 53.695 | |
16a6395 53.865 | |
16a6395 56.194 | |
16a6395 54.499 | |
16a6395 53.606 | |
1ead6d9 54.210 | |
1ead6d9 52.049 | |
1ead6d9 56.881 | |
1ead6d9 64.215 | |
1ead6d9 64.722 | |
1ead6d9 57.736 | |
1ead6d9 56.665 | |
1ead6d9 56.818 | |
1ead6d9 57.846 | |
1ead6d9 57.327 | |
1ead6d9 70.093 | |
1ead6d9 74.658 | |
1ead6d9 75.991 | |
1ead6d9 64.749 | |
1ead6d9 60.855 | |
1ead6d9 57.999 | |
1ead6d9 56.717 | |
1ead6d9 63.631 | |
1ead6d9 60.309 | |
1ead6d9 56.322 | |
f7bd099 59.704 | |
f7bd099 63.626 | |
f7bd099 58.229 | |
f7bd099 60.077 | |
f7bd099 62.601 | |
f7bd099 60.342 | |
f7bd099 61.806 | |
f7bd099 58.224 | |
f7bd099 58.485 | |
f7bd099 61.576 | |
f7bd099 66.935 | |
f7bd099 64.728 | |
f7bd099 61.932 | |
f7bd099 59.714 | |
f7bd099 60.496 | |
f7bd099 59.288 | |
f7bd099 66.083 | |
f7bd099 60.688 | |
f7bd099 61.915 | |
f7bd099 59.950 | |
ade0257 58.162 | |
ade0257 58.376 | |
ade0257 61.135 | |
ade0257 61.028 | |
ade0257 69.336 | |
ade0257 61.868 | |
ade0257 60.355 | |
ade0257 59.971 | |
ade0257 61.402 | |
ade0257 61.355 | |
ade0257 68.301 | |
ade0257 63.104 | |
ade0257 63.459 | |
ade0257 64.373 | |
ade0257 62.076 | |
ade0257 68.960 | |
ade0257 62.048 | |
ade0257 62.695 | |
ade0257 82.253 | |
ade0257 68.557 | |
34897ae 72.567 | |
34897ae 66.733 | |
34897ae 68.297 | |
34897ae 75.012 | |
34897ae 82.730 | |
34897ae 79.048 | |
34897ae 87.963 | |
34897ae 83.361 | |
34897ae 82.368 | |
34897ae 113.356 | |
34897ae 103.348 | |
34897ae 103.930 | |
34897ae 121.413 | |
34897ae 110.167 | |
34897ae 98.303 | |
34897ae 151.314 | |
34897ae 119.240 | |
34897ae 205.961 | |
34897ae 81.833 | |
34897ae 117.545 | |
805b183 80.396 | |
805b183 85.646 | |
805b183 84.254 | |
805b183 78.965 | |
805b183 86.031 | |
805b183 102.953 | |
805b183 143.544 | |
805b183 113.677 | |
805b183 77.668 | |
805b183 68.460 | |
805b183 75.473 | |
805b183 78.413 | |
805b183 67.165 | |
805b183 67.213 | |
805b183 70.940 | |
805b183 69.086 | |
805b183 79.285 | |
805b183 74.220 | |
805b183 113.426 | |
805b183 66.898 | |
3ac6627 81.684 | |
3ac6627 69.547 | |
3ac6627 64.066 | |
3ac6627 66.370 | |
3ac6627 68.885 | |
3ac6627 65.052 | |
3ac6627 67.552 | |
3ac6627 71.885 | |
3ac6627 65.566 | |
3ac6627 66.182 | |
3ac6627 83.517 | |
3ac6627 68.239 | |
3ac6627 85.032 | |
3ac6627 75.275 | |
3ac6627 68.243 | |
3ac6627 68.442 | |
3ac6627 87.119 | |
3ac6627 73.775 | |
3ac6627 67.211 | |
3ac6627 62.909 | |
61a752a 52.229 | |
61a752a 52.327 | |
61a752a 50.483 | |
61a752a 50.100 | |
61a752a 53.707 | |
61a752a 56.383 | |
61a752a 57.362 | |
61a752a 50.570 | |
61a752a 51.342 | |
61a752a 52.495 | |
61a752a 56.389 | |
61a752a 64.335 | |
61a752a 58.350 | |
61a752a 60.450 | |
61a752a 55.815 | |
61a752a 56.844 | |
61a752a 54.973 | |
61a752a 66.249 | |
61a752a 57.441 | |
61a752a 58.211 | |
fa5ce66 56.841 | |
fa5ce66 56.211 | |
fa5ce66 55.053 | |
fa5ce66 50.065 | |
fa5ce66 50.176 | |
fa5ce66 51.418 | |
fa5ce66 59.356 | |
fa5ce66 58.425 | |
fa5ce66 56.330 | |
fa5ce66 56.539 | |
fa5ce66 56.238 | |
fa5ce66 57.978 | |
fa5ce66 55.496 | |
fa5ce66 51.749 | |
fa5ce66 50.342 | |
fa5ce66 50.511 | |
fa5ce66 50.722 | |
fa5ce66 50.816 | |
fa5ce66 51.014 | |
fa5ce66 49.635 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub sum(@values) { | |
[+] @values; | |
} | |
sub mean(@values) { | |
PRE { @values.elems > 0 } | |
sum(@values) / @values.elems; | |
} | |
sub variance(@values) { | |
PRE { @values.elems > 1 } | |
my $m = mean(@values); | |
my $N = @values.elems; | |
sum(@values.map(-> $v { ($v - $m) ** 2 })) / ($N - 1); | |
} | |
sub standard-deviation(@values) { | |
sqrt(variance(@values)); | |
} | |
sub nth-percentile($n, @values) { | |
my $index = ceiling(@values.elems * $n / 100); | |
@values[$index]; | |
} | |
sub ninth(@values) { | |
nth-percentile(9, @values); | |
} | |
sub lower(@values) { | |
mean(@values) - standard-deviation(@values); | |
} | |
sub median(@values) { | |
PRE { @values.elems > 0 } | |
if @values.elems % 2 == 0 { | |
mean([@values[* div 2], @values[* div 2 + 1]]); | |
} | |
else { | |
@values[* div 2]; | |
} | |
} | |
sub upper(@values) { | |
mean(@values) + standard-deviation(@values); | |
} | |
sub ninety-first(@values) { | |
nth-percentile(91, @values); | |
} | |
my %stat; | |
my @commits; | |
given open("stat") -> $fh { | |
for $fh.lines -> $line { | |
$line ~~ /(\S+) \s+ (\S+)/ | |
or die "Unknown format: '$_'"; | |
my $commit = ~$0; | |
my $time-in-seconds = +$1; | |
unless %stat{$commit} :exists { | |
@commits.push($commit); | |
} | |
%stat{$commit}.push($time-in-seconds); | |
} | |
$fh.close; | |
} | |
for @commits -> $commit { | |
my @times = @(%stat{$commit}); | |
@times.=sort(); | |
say sprintf "%s: 9th %7.3f, lower %7.3f, median %7.3f, upper %7.3f, 91st %7.3f", | |
$commit, ninth(@times), lower(@times), median(@times), upper(@times), ninety-first(@times); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl6 diagram-stat | |
a249ded: 9th 53.715, lower 56.044, median 65.215, upper 67.813, 91st 68.390 | |
c32784d: 9th 54.366, lower 54.704, median 57.135, upper 59.695, 91st 62.442 | |
16a6395: 9th 53.540, lower 52.149, median 54.672, upper 59.439, 91st 68.659 | |
1ead6d9: 9th 56.322, lower 54.491, median 59.154, upper 67.488, 91st 75.991 | |
f7bd099: 9th 58.485, lower 58.852, median 61.132, upper 63.788, 91st 66.935 | |
ade0257: 9th 59.971, lower 58.481, median 62.386, upper 69.401, 91st 82.253 | |
34897ae: 9th 72.567, lower 68.323, median 100.826, upper 134.126, 91st 205.961 | |
805b183: 9th 67.213, lower 64.384, median 79.125, upper 103.987, 91st 143.544 | |
3ac6627: 9th 65.052, lower 63.965, median 68.664, upper 78.690, 91st 87.119 | |
61a752a: 9th 50.570, lower 51.380, median 56.386, upper 60.226, 91st 66.249 | |
fa5ce66: 9th 50.176, lower 50.404, median 55.275, upper 57.088, 91st 59.356 |
@MasterDuke17 Only the error message you get when the constraint is broken.
Fwiw, in the Rakudo I have, the constraint is printed out as part of the error message for PRE
, but not for the where
case.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How much of a difference is there between:
and