skills/tabular/regularized-qda-classifier/SKILL.md
Use QuadraticDiscriminantAnalysis with regularization for binary classification on data with Gaussian cluster structure
npx skillsauth add wenmin-wu/ds-skills tabular-regularized-qda-classifierInstall 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.
Quadratic Discriminant Analysis models each class as a multivariate Gaussian with its own covariance matrix. When features are truly Gaussian-distributed (synthetic data, physical measurements), QDA can outperform tree-based models by directly modeling the decision boundary. The reg_param shrinks per-class covariance toward the pooled estimate, preventing singularity on high-dimensional or small-sample data.
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import roc_auc_score
import numpy as np
oof = np.zeros(len(X))
preds = np.zeros(len(X_test))
skf = StratifiedKFold(n_splits=11, shuffle=True, random_state=42)
for train_idx, val_idx in skf.split(X, y):
clf = QuadraticDiscriminantAnalysis(reg_param=0.5)
clf.fit(X[train_idx], y[train_idx])
oof[val_idx] = clf.predict_proba(X[val_idx])[:, 1]
preds += clf.predict_proba(X_test)[:, 1] / skf.n_splits
print(f'AUC: {roc_auc_score(y, oof):.4f}')
reg_param in [0.1, 0.5] via cross-validationmake_classification, physical sensor data, or any setting where classes form elliptical clustersdata-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