Skip to content

fix(metrics): shrink the position factor by mention evidence - #584

Merged
gkhngyk merged 1 commit into
mainfrom
fix/position-factor-low-sample
Aug 3, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/position-factor-low-sample

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

A competitor named first in 6 of ~16k answers ranked 4th on a brand's 30d leaderboard, above one named in 500+ answers. The position factor is an average over only the answers that mention the entity, so a perfect 1.0 average on a tiny sample paid out the full 15-point position weight as a floor.

The position term now enters the blend with evidence shrinkage:

score = 100 × (0.6 × mention rate
             + 0.25 × citation rate
             + 0.15 × position factor × mentionAnswers / (mentionAnswers + 10))
  • Thin samples are damped toward zero (the reported case drops from 15.0 → 5.7 and falls to the bottom half of the leaderboard).
  • High-volume entities are untouched — support ≈ 1 from a few dozen mentions up (a 3.9k-mention competitor shifts by ~0.05 points).
  • Both mirrors of the score module (web/src/lib/visibility-score.ts, server/src/config/visibility-score.js) change identically, so every surface re-ranks consistently — leaderboard, trend chart (the misranked competitor also leaves the top-4 lines), Daily Pulse, reports, MCP, Looker.
  • Nothing is re-analyzed and no stored data changes: the score is computed at read time from the same components.
  • The Formulas dialog documents the evidence weighting in the position-factor bullet.
  • Unit tests updated for the new math + a regression test for the thin-sample case.

Related issue

Customer report (no tracked issue).

Type of change

  • fix — Bug fix

How to test

  1. On a brand where a rarely-mentioned competitor with a perfect position ranked implausibly high, reload Insights: it drops to a rank consistent with its actual presence, and the trend chart's plotted competitors match the new leaderboard order.
  2. High-volume competitors' scores are visually unchanged.
  3. yarn test in web/ (7 score tests) and yarn vitest run in server/ pass.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

A competitor named first in 6 of 16k answers scored a flat 15-point
position floor (0.15 × a perfect 1.0 average over 6 samples) and ranked
4th on the leaderboard, above one named in 500+ answers. The position
factor now enters the blend as pf × mentionAnswers / (mentionAnswers +
10): thin samples are damped toward zero while high-volume entities are
untouched (support ≈ 1 from a few dozen mentions up). Both mirrors of
the score module change identically, so every surface — leaderboard,
trend chart, pulse, reports, MCP — re-ranks consistently; nothing is
re-analyzed and no stored data changes. The Formulas dialog documents
the evidence weighting.
@gkhngyk
gkhngyk merged commit 6ad0a8f into main Aug 3, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant