skills/timeseries/flux-snr-weighted-features/SKILL.md
Engineer SNR-derived features from irregular time series — flux ratio squared, error-weighted mean flux, and normalized amplitude/range features
npx skillsauth add wenmin-wu/ds-skills timeseries-flux-snr-weighted-featuresInstall 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.
For irregular time series with measurement errors (e.g. astronomical light curves, sensor data with noise estimates), engineer signal-to-noise features that weight observations by their reliability. Compute (flux/flux_err)^2 as SNR weight, then derive error-weighted mean flux, normalized amplitude, and range-over-mean ratios. These features are far more predictive than raw flux statistics for noisy data.
import numpy as np
def flux_snr_features(df, id_col='object_id'):
"""Engineer SNR-weighted features from flux + flux_err columns."""
df['flux_ratio_sq'] = np.power(df['flux'] / df['flux_err'], 2.0)
df['flux_by_flux_ratio_sq'] = df['flux'] * df['flux_ratio_sq']
aggs = {
'flux': ['min', 'max', 'mean', 'median', 'std', 'skew'],
'flux_err': ['min', 'max', 'mean', 'std'],
'flux_ratio_sq': ['sum', 'skew'],
'flux_by_flux_ratio_sq': ['sum', 'skew'],
}
result = df.groupby(id_col).agg(aggs)
result.columns = ['_'.join(x) for x in result.columns]
# Error-weighted mean flux
result['flux_w_mean'] = (
result['flux_by_flux_ratio_sq_sum'] / result['flux_ratio_sq_sum'])
# Normalized dynamic range
result['flux_dif2'] = (
(result['flux_max'] - result['flux_min']) / result['flux_mean'])
result['flux_dif3'] = (
(result['flux_max'] - result['flux_min']) / result['flux_w_mean'])
return result
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