skills/tabular/row-wise-target-normalization/SKILL.md
Normalizes each sample's multi-output target vector to zero mean and unit variance, removing per-sample scale differences before training.
npx skillsauth add wenmin-wu/ds-skills tabular-row-wise-target-normalizationInstall 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.
In multi-output regression (e.g., predicting 140 protein levels per cell), each sample's target vector can have a different overall magnitude and offset. Row-wise normalization (subtract row mean, divide by row std) removes these per-sample differences, letting the model focus on relative patterns across outputs. This is critical when the evaluation metric is row-wise Pearson correlation, which is inherently scale- and offset-invariant — training on unnormalized targets wastes capacity learning per-sample baselines.
import numpy as np
# Y shape: (n_samples, n_targets)
row_mean = Y.mean(axis=1, keepdims=True)
row_std = Y.std(axis=1, keepdims=True)
Y_norm = (Y - row_mean) / (row_std + 1e-8)
# Train model on normalized targets
model.fit(X_train, Y_norm)
# At inference — no denormalization needed if metric is correlation
preds = model.predict(X_test)
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