skills/timeseries/temporal-frame-binning/SKILL.md
Reduce temporal resolution by averaging consecutive frame blocks to improve SNR and compress high-cadence data
npx skillsauth add wenmin-wu/ds-skills timeseries-temporal-frame-binningInstall 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.
High-cadence sensors produce more frames than needed for the signal of interest. Bin consecutive frames by averaging (or summing) to reduce noise by √N and compress data. Apply after noise-removal steps (CDS, dark subtraction) but before feature extraction.
import numpy as np
def temporal_bin(signal, bin_size, method='mean'):
"""Bin consecutive frames along time axis.
Args:
signal: (..., T, ...) array with T timesteps
bin_size: number of frames per bin
method: 'mean' (improves SNR) or 'sum' (preserves counts)
"""
T = signal.shape[-2]
n_bins = T // bin_size
# Reshape to group frames
truncated = signal[..., :n_bins * bin_size, :]
shape = (*truncated.shape[:-2], n_bins, bin_size, *truncated.shape[-1:])
grouped = truncated.reshape(shape)
if method == 'mean':
return grouped.mean(axis=-2)
return grouped.sum(axis=-2)
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