skills/timeseries/inverse-variance-channel-weighting/SKILL.md
Weight multi-channel signals by inverse per-channel variance with percentile clipping, emphasizing low-noise channels in aggregation
npx skillsauth add wenmin-wu/ds-skills timeseries-inverse-variance-channel-weightingInstall 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 aggregating multi-channel (multi-band, multi-sensor) time series, weight each channel by the inverse of its temporal variance. Noisy channels get downweighted; stable channels dominate. Clip extreme weights at the 5th/95th percentile to prevent any single channel from dominating, then normalize so weights sum to the number of channels (preserving scale).
import numpy as np
def inverse_variance_weight(data, clip_pct=(5.0, 95.0)):
"""Weight channels by inverse variance.
Args:
data: (n_timesteps, n_channels) array
clip_pct: percentile bounds for weight clipping
Returns:
weighted data (n_timesteps, n_channels)
"""
var = np.nanvar(data, axis=0, ddof=1)
median_var = np.nanmedian(var)
# Replace invalid variances with median
safe_var = np.where(~np.isfinite(var) | (var <= 0), median_var, var)
weights = 1.0 / safe_var
# Clip extremes
lo, hi = np.nanpercentile(weights, clip_pct)
if lo < hi:
weights = np.clip(weights, lo, hi)
# Normalize to preserve scale
n_channels = data.shape[1]
weights *= n_channels / np.nansum(weights)
return data * weights[None, :]
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