machine-learning: Add stratified-samples for getting multiple samples.

Doug Coleman 2012-11-28 09:13:16 -08:00
parent 040a7b8e8b
commit a851909788
1 changed files with 3 additions and 0 deletions

View File

@ -22,6 +22,9 @@ MEMO: probabilities-seq ( seq -- seq' )
: stratified-sample ( stratified-sequences probability-sequence -- elt )
probabilities-quot call swap nth random ; inline
: stratified-samples ( stratified-sequences probability-sequence n -- elt )
[ '[ _ _ stratified-sample ] ] dip swap replicate ;
: equal-stratified-sample ( stratified-sequences -- elt )
random random ; inline