← ClaudeAtlas

algo-rank-wilsonlisted

"Calculate Wilson Score confidence intervals for ranking items by positive proportion with sample size correction. Use this skill when the user needs to rank products by ratings, sort content by approval rate, or build a 'best rated' list that accounts for sample size — even if they say 'rank by star rating', 'best rated with few reviews', or 'confidence-adjusted rating'.".
charlieviettq/awesome-agent-skill · ★ 25 · AI & Automation · score 80
Install: claude install-skill charlieviettq/awesome-agent-skill
# Wilson Score Ranking ## Overview Wilson Score interval provides a lower confidence bound on the true proportion of positive ratings. Unlike simple averages, it penalizes items with few ratings, preventing a 5/5 review item (1 review) from outranking a 4.8/5 item (1000 reviews). Computes in O(1) per item. ## When to Use **Trigger conditions:** - Ranking items by user ratings when review counts vary widely - Building "top rated" or "best of" lists that are fair to well-reviewed items - Sorting binary feedback (upvote/downvote) with confidence **When NOT to use:** - For continuous scores (use Bayesian average instead) - When comparing items with similar sample sizes (simple average suffices) ## Algorithm ``` IRON LAW: Never Rank by Simple Average When Sample Sizes Differ A 5.0 average from 1 review is NOT better than 4.8 from 1000 reviews. Wilson Score lower bound accounts for sample uncertainty: Items with few ratings get a LOWER bound, properly reflecting our uncertainty about their true quality. ``` ### Phase 1: Input Validation Collect per item: number of positive ratings (p), total ratings (n). For star ratings, convert to binary (e.g., 4-5 stars = positive). **Gate:** n > 0 for all items, confidence level chosen (typically 95%, z=1.96). ### Phase 2: Core Algorithm 1. Compute observed proportion: p̂ = positive / total 2. Wilson lower bound: (p̂ + z²/2n - z × √(p̂(1-p̂)/n + z²/4n²)) / (1 + z²/n) 3. Rank by Wilson lower bound descending (conservative estimate of tr