skills/tabular/rank-averaging-ensemble/SKILL.md
Ensembles multiple model predictions by converting to ranks, averaging, and normalizing back to [0,1].
npx skillsauth add wenmin-wu/ds-skills tabular-rank-averaging-ensembleInstall 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.
Combine predictions from multiple models by converting each to ranks, averaging the ranks, then normalizing to [0,1]. This is robust to different prediction scales and distributions across models, making it ideal when blending heterogeneous model families.
import numpy as np
from scipy.stats import rankdata
def rank_average(predictions_list):
"""Ensemble by rank averaging.
Args:
predictions_list: list of arrays, each shape (n_samples,)
Returns:
array of shape (n_samples,) with averaged ranks normalized to [0,1]
"""
ranks = np.column_stack([
rankdata(preds) for preds in predictions_list
])
avg_ranks = ranks.mean(axis=1)
return (avg_ranks - avg_ranks.min()) / (avg_ranks.max() - avg_ranks.min())
scipy.stats.rankdatarankdata uses average ranks by default; fine for most casesdata-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