(population, k, split_every)
| 111 | |
| 112 | |
| 113 | def _sample(population, k, split_every): |
| 114 | if k < 0: |
| 115 | raise ValueError("Cannot take a negative number of samples") |
| 116 | return population.reduction( |
| 117 | partial(_sample_map_partitions, k=k), |
| 118 | partial(_sample_reduce, k=k, replace=False), |
| 119 | out_type=Bag, |
| 120 | split_every=split_every, |
| 121 | ) |
| 122 | |
| 123 | |
| 124 | def _finalize_sample(reduce_iter, k): |