How can sorted samples be split into similarly sized review batches?
NTILE divides ordered rows into buckets of nearly equal size and places larger buckets first.
SQLite example and interpretation
Five samples in two batches produce three followed by two. Equal risk scores can straddle a bucket boundary because the rule targets row counts.
WITH r(id) AS (VALUES(1),(2),(3),(4),(5)) SELECT id,ntile(2) OVER(ORDER BY id) FROM r ORDER BY id;Result [[1, 1], [2, 1], [3, 1], [4, 2], [5, 2]]
中文
怎样把已排序样本划成数量接近的审核批次?
NTILE 将分区按行数分桶,无法均分时较大的桶排在前面。
SQLite 示例与适用条件
五个样本分两批,第一批三项、第二批两项。即便两条风险分数完全相同,桶边界也可能将其拆开。
WITH r(id) AS (VALUES(1),(2),(3),(4),(5)) SELECT id,ntile(2) OVER(ORDER BY id) FROM r ORDER BY id;结果 [[1, 1], [2, 1], [3, 1], [4, 2], [5, 2]]