skills/nlp/category-weighted-score-fusion/SKILL.md
Converts multi-label binary flags into a continuous regression target by applying hand-tuned per-category multipliers, then averaging across categories.
npx skillsauth add wenmin-wu/ds-skills nlp-category-weighted-score-fusionInstall 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.
When a dataset has multiple binary label columns (e.g., toxic, obscene, threat, insult) but the task requires a single severity score, naive averaging treats all categories equally. Category-weighted fusion applies hand-tuned multipliers to each flag before averaging — rare/severe categories (threat, identity_hate) get higher weights, common/mild ones (obscene) get lower weights. This produces a continuous pseudo-target that better reflects severity ordering for ranking tasks.
import pandas as pd
# Multi-label columns with binary flags
label_cols = ['toxic', 'severe_toxic', 'obscene', 'threat', 'insult', 'identity_hate']
# Per-category multipliers (tune on validation)
weights = {
'toxic': 0.32,
'severe_toxic': 1.5,
'obscene': 0.16,
'threat': 1.5,
'insult': 0.64,
'identity_hate': 1.5,
}
for col in label_cols:
df[col] = df[col] * weights[col]
df['score'] = df[label_cols].mean(axis=1)
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