skills/nlp/multisample-dropout/SKILL.md
Applies multiple dropout masks to the same hidden state and averages predictions for regularization and variance reduction.
npx skillsauth add wenmin-wu/ds-skills nlp-multisample-dropoutInstall 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.
Instead of a single dropout mask, apply N different dropout masks to the pooled representation and average the resulting logits. During training this acts as stronger regularization; during inference it functions as a cheap ensemble of N sub-networks without N forward passes through the backbone.
import torch.nn as nn
class MultisampleDropoutHead(nn.Module):
def __init__(self, hidden_size, n_dropouts=5, drop_rate=0.3):
super().__init__()
self.dropouts = nn.ModuleList([nn.Dropout(drop_rate) for _ in range(n_dropouts)])
self.regressor = nn.Linear(hidden_size, 1)
def forward(self, hidden_state):
logits = None
for i, dropout in enumerate(self.dropouts):
out = self.regressor(dropout(hidden_state))
logits = out if logits is None else logits + out
return logits / len(self.dropouts)
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