:weighted-score derived measure
Bayesian / IMDB-style composite measure: blend an average and a count into one sortable score so low-count items stop outranking well-rated ones (one 5-star rating vs fifty ratings averaging 4.8). First instance of a registered composite measure — a registry entry over sibling measure fields with a parameter schema (validates the model, drives the no-code palette, serves as the AI spec). Not an expression DSL; no raw code in the model.
:score (:type :real
:derived (:weighted-score
:avg-field :recent-avg
:count-field :recent-ratings
:prior 5)
:sortable t)
Formula: (v/(v+m))·R + (m/(v+m))·C where v = the count field, R = the avg field, m = author-declared :prior (positive), C = grand mean of the same (filtered) facts the aggregates read — computed once per request, bound as a parameter.
Semantics to freeze when specified:
COALESCEaround R inside the expression; SQL NULL must not propagate through the arithmetic- Zero facts → score = C exactly (dead models sit at the prior, mid-board; still findable by ascending sort)
:avg-field/:count-fieldmust name sibling measure fields on the same rollup; compile error otherwise
Why post-MVP: it is a measure Phase A expression (sortable, page-honest), so it needs items 08–10 green first; and where the count is "distinct users that rated", it consumes the Issue 16 fan-out rules — a wrong count silently poisons the score. Named consumers: Model Bank ranked by score instead of raw average. Future curated formulas (time decay for "hot", Wilson lower bound for "controversial") follow the same registered-measure pattern.
- Slot
- 16000
- Status
- 10 Open
- Tags
- backend, model, compiler
- Contributors
- Donnie