mlr bootstrap

This commit is contained in:
John Kerl 2016-01-09 11:55:48 +00:00
parent 6670ce0df0
commit 575c8e12ff
6 changed files with 89 additions and 11 deletions

View file

@ -30,7 +30,7 @@ static void mapper_bootstrap_usage(FILE* o, char* argv0, char* verb) {
fprintf(o, "Usage: %s %s [options]\n", argv0, verb);
fprintf(o, "Emits an n-sample, with replacement, of the input records.\n");
fprintf(o, "Options:\n");
fprintf(o, "-n {number} NUmber of samples to output. Defaults to number of input records.\n");
fprintf(o, "-n {number} Number of samples to output. Defaults to number of input records.\n");
fprintf(o, " Must be non-negative.\n");
}

View file

@ -642,6 +642,44 @@ top_idx=1,x_top=9223372036854775808.000000,y_top=-9223372036854775808.000000
top_idx=2,x_top=9223372036854775808.000000,y_top=-9223372036854775808.000000
top_idx=3,x_top=9223372036854775808.000000,y_top=-9223372036854775808.000000
mlr --seed 12345 bootstrap ./reg_test/input/abixy-het
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
mlr --seed 12345 bootstrap -n 2 ./reg_test/input/abixy-het
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
mlr --seed 12345 bootstrap -n 20 ./reg_test/input/abixy-het
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=eks,bbb=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
aaa=hat,bbb=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
a=zee,b=wye,i=8,x=0.5985540091064224,yyy=0.976181385699006
mlr --seed 12345 sample -k 2 ./reg_test/input/abixy-het
aaa=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797

View file

@ -179,6 +179,10 @@ run_mlr top -n 3 -f x,y --min $indir/near-ovf.dkvp
run_mlr top -F -n 3 -f x,y $indir/near-ovf.dkvp
run_mlr top -F -n 3 -f x,y --min $indir/near-ovf.dkvp
run_mlr --seed 12345 bootstrap $indir/abixy-het
run_mlr --seed 12345 bootstrap -n 2 $indir/abixy-het
run_mlr --seed 12345 bootstrap -n 20 $indir/abixy-het
run_mlr --seed 12345 sample -k 2 $indir/abixy-het
run_mlr --seed 12345 sample -k 2 -g a $indir/abixy-het
run_mlr --seed 12345 sample -k 2 -g a,b $indir/abixy-het

View file

@ -326,6 +326,11 @@ POKI_RUN_COMMAND{{mlr --opprint bar --lo 0.4 --hi 0.6 -f x,y data/small}}HERE
POKI_RUN_COMMAND{{mlr --opprint bar --auto -f x,y data/small}}HERE
<!-- ================================================================ -->
<h2>bootstrap</h2>
POKI_RUN_COMMAND{{mlr bootstrap --help}}HERE
<!-- ================================================================ -->
<h2>cat</h2>

View file

@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2016-01-07
.\" Date: 2016-01-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2016-01-07" "\ \&" "\ \&"
.TH "MILLER" "1" "2016-01-09" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -127,9 +127,9 @@ output separator to the given value.
.RS 0
.\}
.nf
bar cat check count-distinct cut decimate filter grep group-by group-like
having-fields head histogram join label merge-fields put regularize rename
reorder sample sec2gmt sort stats1 stats2 step tac tail top uniq
bar bootstrap cat check count-distinct cut decimate filter grep group-by
group-like having-fields head histogram join label merge-fields put regularize
rename reorder sample sec2gmt sort stats1 stats2 step tac tail top uniq
.fi
.if n \{\
.RE
@ -326,6 +326,19 @@ Options:
.fi
.if n \{\
.RE
.SS "bootstrap"
.if n \{\
.RS 0
.\}
.nf
Usage: mlr bootstrap [options]
Emits an n-sample, with replacement, of the input records.
Options:
-n {number} Number of samples to output. Defaults to number of input records.
Must be non-negative.
.fi
.if n \{\
.RE
.SS "cat"
.if n \{\
.RS 0
@ -726,7 +739,7 @@ mlr reorder -e -f a,b sends input record "d=4,b=2,a=1,c=3" to "d=4,c=3,a=1,b=2".
.\}
.nf
Usage: mlr sample [options]
Reservoir sampling, optionally by category.
Reservoir sampling (subsampling without replacement), optionally by category.
-k {count} Required: number of records to output, total, or by group if using -g.
-g {a,b,c} Optional: group-by-field names for samples.
.fi

View file

@ -146,6 +146,7 @@ Miller commands were run with pretty-print-tabular output format.
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#Number_formatting">Number formatting</a><br/>
&bull;&nbsp;<a href="#Data_transformations">Data transformations</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#bar">bar</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#bootstrap">bootstrap</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#cat">cat</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#check">check</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#decimate">decimate</a><br/>
@ -337,9 +338,10 @@ Help options:
--help-all-verbs Show help on all verbs.
Verbs:
bar cat check count-distinct cut decimate filter grep group-by group-like
having-fields head histogram join label merge-fields put regularize rename
reorder sample sec2gmt sort stats1 stats2 step tac tail top uniq
bar bootstrap cat check count-distinct cut decimate filter grep group-by
group-like having-fields head histogram join label merge-fields put
regularize rename reorder sample sec2gmt sort stats1 stats2 step tac tail
top uniq
Functions for the filter and put verbs:
+ + - - * / // % ** | ^ &amp; ~ &lt;&lt; &gt;&gt; == != =~ !=~ &gt; &gt;= &lt; &lt;= &amp;&amp; || ^^ ! boolean
@ -907,6 +909,22 @@ wye pan 5 [0.204603]**************************..............[0.75868] [0.134189]
</div>
<p/>
<!-- ================================================================ -->
<a id="bootstrap"/><h2>bootstrap</h2>
<p/>
<div class="pokipanel">
<pre>
$ mlr bootstrap --help
Usage: mlr bootstrap [options]
Emits an n-sample, with replacement, of the input records.
Options:
-n {number} Number of samples to output. Defaults to number of input records.
Must be non-negative.
</pre>
</div>
<p/>
<!-- ================================================================ -->
<a id="cat"/><h2>cat</h2>
@ -2258,7 +2276,7 @@ wye 0.5732889198020006 0.8636244699032729 5 pan
<pre>
$ mlr sample --help
Usage: mlr sample [options]
Reservoir sampling, optionally by category.
Reservoir sampling (subsampling without replacement), optionally by category.
-k {count} Required: number of records to output, total, or by group if using -g.
-g {a,b,c} Optional: group-by-field names for samples.
</pre>