Skip to content
Back to skills

Inverse Variance Channel Weighting

ASecurity

Weight multi-channel signals by inverse per-channel variance with percentile clipping, emphasizing low-noise channels in aggregation

  • 61 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
documentationpython

Works with

  • cli

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill inverse-variance-channel-weighting --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Inverse Variance Channel Weighting?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Inverse Variance Channel Weighting
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-inverse-variance-channel-weighting/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-inverse-variance-channel-weighting)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: timeseries-inverse-variance-channel-weighting
description: Weight multi-channel signals by inverse per-channel variance with percentile clipping, emphasizing low-noise channels in aggregation
domain: timeseries
---

# Inverse-Variance Channel Weighting

## Overview

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).

## Quick Start

```python
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, :]
```

## Key Decisions

- **Percentile clipping**: prevents one ultra-stable channel from getting all the weight
- **Median fallback**: channels with zero/nan variance get median weight, not infinity
- **Scale-preserving normalization**: weights sum to n_channels so overall magnitude is unchanged
- **General purpose**: applies to any multi-channel signal — spectral, multi-sensor, multi-band

## References

- Source: [0-374-lb-score-bronze-medal](https://www.kaggle.com/code/antonoof/0-374-lb-score-bronze-medal)
- Competition: NeurIPS - Ariel Data Challenge 2025

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.