Skip to content
Back to skills

Regularized Qda Classifier

ASecurity

Use QuadraticDiscriminantAnalysis with regularization for binary classification on data with Gaussian cluster structure

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
datapython

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill regularized-qda-classifier --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Regularized Qda Classifier?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Regularized Qda Classifier
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-regularized-qda-classifier/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-regularized-qda-classifier)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: tabular-regularized-qda-classifier
description: Use QuadraticDiscriminantAnalysis with regularization for binary classification on data with Gaussian cluster structure
---

# Regularized QDA Classifier

## Overview

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.

## Quick Start

```python
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}')
```

## Workflow

1. Identify that data has Gaussian structure (scatter plots show elliptical clusters)
2. Apply feature selection (VarianceThreshold) to remove noise features
3. Standardize features (optional — QDA is scale-invariant but helps numerically)
4. Train QDA with `reg_param` in [0.1, 0.5] via cross-validation
5. Average fold predictions for test set

## Key Decisions

- **reg_param**: 0.0 = full QDA (each class has own covariance); 1.0 = LDA (shared covariance). Start at 0.5
- **When to use**: data generated by `make_classification`, physical sensor data, or any setting where classes form elliptical clusters
- **Feature count**: QDA estimates O(p^2) parameters per class — reduce features first if p > 50
- **vs LDA**: QDA wins when classes have different covariance shapes; LDA wins when covariances are similar

## References

- [Pseudo Labeling - QDA - [0.969]](https://www.kaggle.com/code/cdeotte/pseudo-labeling-qda-0-969)
- [Instant Gratification (QDA)](https://www.kaggle.com/code/rohandeysarkar/instant-gratification-qda)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…