skills/tabular/chained-target-prediction/SKILL.md
Predict correlated targets sequentially, using earlier target predictions as input features for subsequent targets to exploit inter-target dependencies
npx skillsauth add wenmin-wu/ds-skills tabular-chained-target-predictionInstall 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.
When multiple targets are correlated (e.g., different engagement metrics for the same entity), predicting them independently wastes inter-target signal. Chained prediction trains target1 first, then feeds its prediction as an additional feature when training target2, and so on. This captures causal or correlational structure between targets without requiring a multi-output model.
import lightgbm as lgb
import numpy as np
targets = ["target1", "target2", "target3", "target4"]
models = {}
feature_cols_base = [c for c in X.columns if c not in targets]
for i, target in enumerate(targets):
feat_cols = feature_cols_base + targets[:i] # add earlier targets as features
model = lgb.LGBMRegressor(**params[target])
model.fit(X_train[feat_cols], y_train[target])
models[target] = model
# Add predictions to both train and test for downstream targets
X_train[target] = np.clip(model.predict(X_train[feat_cols]), 0, 100)
X_test[target] = np.clip(model.predict(X_test[feat_cols]), 0, 100)
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