Weighted position decay ensemble

From wenmin-wu/ds-skills · View interactive version

Weighted position decay ensemble is an AI agent skill from the GitHub repository wenmin-wu/ds-skills. Ensembles multiple ranked recommendation lists by scoring items as model_weight / position_rank, then re-ranking.

How to use this skill

Skill file

Weighted Position Decay Ensemble

Overview

When combining ranked lists from multiple recommendation models, score each item as model_weight / (position + 1). Items appearing in multiple lists accumulate scores. Re-rank by total score to produce the final list. This naturally favors items ranked high by strong models while still crediting items from weaker ones.

Quick Start

def blend_recommendations(rec_lists, weights):
    """Blend multiple ranked recommendation lists.

    Args:
        rec_lists: list of lists, each a ranked recommendation
        weights: list of floats, per-model importance weight

    Returns:
        list of items sorted by blended score
    """
    scores = {}
    for recs, w in zip(rec_lists, weights):
        for rank, item in enumerate(recs):
            scores[item] = scores.get(item, 0) + w / (rank + 1)
    ranked = sorted(scores, key=scores.get, reverse=True)
    return ranked[:12]

Workflow

  1. Generate ranked recommendation lists from each model
  2. Assign importance weight to each model (tune on validation)
  3. Score each item: accumulate weight / (rank + 1) across models
  4. Sort by total score, take top-K

Key Decisions

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.