Skip to content
Back to skills

Logspace Recency Reranking

ASecurity

Rerank session candidates using log-spaced recency weights multiplied by interaction-type multipliers

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
devopspython

Works with

  • cli

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill logspace-recency-reranking --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Logspace Recency Reranking?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Logspace Recency Reranking
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-logspace-recency-reranking/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-logspace-recency-reranking)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tabular-logspace-recency-reranking
description: Rerank session candidates using log-spaced recency weights multiplied by interaction-type multipliers
domain: tabular
---

# Logspace Recency Reranking

## Overview

When reranking items from a user's session history, assign weights that grow logarithmically from oldest to newest event. Multiply by interaction-type multipliers (orders > carts > clicks) so recent high-intent actions dominate. Accumulate weighted scores per item via Counter and return top-K.

## Quick Start

```python
import numpy as np
from collections import Counter

def rerank_by_recency(aids, types, type_multipliers={0:1, 1:6, 2:3},
                      top_k=20):
    """Rerank candidates with logspace recency + type weights.
    
    Args:
        aids: list of item IDs in chronological order
        types: list of interaction types (0=click, 1=cart, 2=order)
        type_multipliers: weight per interaction type
        top_k: number of items to return
    """
    weights = np.logspace(0.1, 1, len(aids), base=2, endpoint=True) - 1
    scores = Counter()
    for aid, w, t in zip(aids, weights, types):
        scores[aid] += w * type_multipliers[t]
    return [aid for aid, _ in scores.most_common(top_k)]
```

## Key Decisions

- **Logspace base=2**: gentle curve; base=10 over-emphasizes the last few events
- **Subtract 1**: shifts range so oldest weight starts near 0, newest near 1
- **Type multipliers**: same as co-visitation weights for consistency across pipeline
- **Chronological order**: pass events oldest-first so logspace assigns highest weight to most recent

## References

- Source: [candidate-rerank-model-lb-0-575](https://www.kaggle.com/code/cdeotte/candidate-rerank-model-lb-0-575)
- Competition: OTTO - Multi-Objective Recommender System

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.