skills/tabular/confidence-probability-clipping/SKILL.md
Hard-clips predicted probabilities to 0 or 1 when they exceed high-confidence thresholds, reducing log loss on near-certain predictions.
npx skillsauth add wenmin-wu/ds-skills tabular-confidence-probability-clippingInstall 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.
Log loss penalizes confident wrong predictions exponentially — predicting 0.99 when the true label is 0 costs 100x more than predicting 0.5. But for predictions the model is very confident about, the risk of being wrong is low. Clipping probabilities above/below asymmetric thresholds (e.g., >0.86→1.0, <0.14→0.0) converts these near-certain soft predictions to hard ones. When correct, this eliminates residual log loss from the epsilon gap; when wrong, the loss is bounded by the threshold. On balanced log loss metrics, this typically improves score by 0.001-0.01.
import numpy as np
def clip_confident_predictions(probs, upper=0.86, lower=0.14):
"""Hard-clip probabilities at confidence thresholds.
Args:
probs: predicted P(class_0), shape (n,)
upper: threshold above which to clip to 1.0
lower: threshold below which to clip to 0.0
Returns:
Clipped probabilities
"""
clipped = probs.copy()
clipped[clipped > upper] = 1.0
clipped[clipped < lower] = 0.0
return clipped
p0 = model.predict_proba(X_test)[:, 0]
p0 = clip_confident_predictions(p0, upper=0.86, lower=0.14)
submission['class_0'] = p0
submission['class_1'] = 1 - p0
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