skills/timeseries/mc-dropout-uncertainty/SKILL.md
Estimate prediction uncertainty via Monte Carlo Dropout — run inference N times with dropout active and compute mean/std
npx skillsauth add wenmin-wu/ds-skills timeseries-mc-dropout-uncertaintyInstall 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.
Monte Carlo Dropout keeps dropout active at inference time and runs N forward passes. The mean gives a smoothed prediction; the standard deviation gives a calibrated uncertainty estimate. No architectural changes needed — just force training=True on dropout layers.
import numpy as np
def mc_dropout_predict(model, X, n_samples=100):
"""Run N stochastic forward passes and return mean + std."""
preds = np.stack([model(X, training=True).numpy() for _ in range(n_samples)])
return preds.mean(axis=0), preds.std(axis=0)
# PyTorch version
def mc_predict_torch(model, X, n_samples=100):
model.train() # keeps dropout active
with torch.no_grad():
preds = torch.stack([model(X) for _ in range(n_samples)])
return preds.mean(0), preds.std(0)
sqrt(σ1² + σ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