skills/tabular/popularity-fallback-recommendation/SKILL.md
Fills unfilled recommendation slots with globally popular recent items to handle cold-start users and short lists.
npx skillsauth add wenmin-wu/ds-skills tabular-popularity-fallback-recommendationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Personalized models often produce fewer than K recommendations for inactive or new users. Fill remaining slots with the most popular items from a recent time window. This simple fallback significantly boosts MAP@K by ensuring every user gets a full recommendation list.
import pandas as pd
def get_popular_items(transactions, days=7, top_k=12):
cutoff = transactions["t_dat"].max() - pd.Timedelta(days=days)
recent = transactions[transactions["t_dat"] >= cutoff]
return recent["article_id"].value_counts().head(top_k).index.tolist()
def fill_recommendations(user_recs, popular, k=12):
"""Pad user's rec list with popular items up to k."""
seen = set(user_recs)
for item in popular:
if len(user_recs) >= k:
break
if item not in seen:
user_recs.append(item)
seen.add(item)
return user_recs[:k]
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF