How do you average model-level means with one vote per model?
An ordinary CTE names a query result so an outer aggregate can operate on already grouped rows.
SQLite example and interpretation
A scores two twice and B scores eight once. Averaging the two model means gives five, appropriate when each model gets one vote irrespective of evaluation count.
WITH s(m,v) AS (VALUES('A',2),('A',2),('B',8)), per_model AS (SELECT m,avg(v) v FROM s GROUP BY m) SELECT avg(v) FROM per_model;Result [[5.0]]
中文
如何先计算每个模型的平均值,再比较模型之间的典型水平?
普通 CTE 将一层查询命名,外层可以在已分组的结果上执行另一层聚合。
SQLite 示例与适用条件
模型 A 两次得 2,B 一次得 8,先按模型平均再平均得到 5。它回答模型等权问题,和按评测次数加权不同。
WITH s(m,v) AS (VALUES('A',2),('A',2),('B',8)), per_model AS (SELECT m,avg(v) v FROM s GROUP BY m) SELECT avg(v) FROM per_model;结果 [[5.0]]