Skip to content
Back to skills

Column Shuffle Augmentation

ASecurity

Augments imbalanced tabular data by independently shuffling each feature column within a class, creating synthetic samples that preserve per-column marginal distributions.

  • 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 column-shuffle-augmentation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Column Shuffle Augmentation?

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

Security grade badge for Column Shuffle Augmentation
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-column-shuffle-augmentation/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-column-shuffle-augmentation)

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-column-shuffle-augmentation
description: >
  Augments imbalanced tabular data by independently shuffling each feature column within a class, creating synthetic samples that preserve per-column marginal distributions.
---
# Column Shuffle Augmentation

## Overview

For imbalanced binary classification, you need more minority samples but SMOTE-style interpolation doesn't work well with high-dimensional anonymous features. Instead, independently shuffle each column within the minority class — this creates new rows that preserve each feature's marginal distribution while breaking inter-feature correlations. Apply asymmetrically: more copies for the minority class.

## Quick Start

```python
import numpy as np

def augment(X, y, t_pos=2, t_neg=1):
    augmented_X, augmented_y = [X], [y]
    for _ in range(t_pos):
        x1 = X[y == 1].copy()
        for c in range(x1.shape[1]):
            np.random.shuffle(x1[:, c])
        augmented_X.append(x1)
        augmented_y.append(np.ones(len(x1)))
    for _ in range(t_neg):
        x0 = X[y == 0].copy()
        for c in range(x0.shape[1]):
            np.random.shuffle(x0[:, c])
        augmented_X.append(x0)
        augmented_y.append(np.zeros(len(x0)))
    return np.vstack(augmented_X), np.concatenate(augmented_y)

X_aug, y_aug = augment(X_train.values, y_train.values, t_pos=2, t_neg=1)
```

## Workflow

1. Separate samples by class label
2. For each augmentation round, copy the class subset
3. Shuffle each column independently (breaks correlations)
4. Append synthetic rows with correct labels
5. Train on the augmented dataset

## Key Decisions

- **Multiplier ratio**: More copies for minority (2-3x) than majority (0-1x)
- **Per-fold augmentation**: Augment inside CV loop, not before, to avoid leakage
- **Multi-seed averaging**: Train N models with different shuffle seeds, average predictions
- **Trade-off**: Breaks real feature correlations — works best when individual features are informative independently

## References

- [LGB 2 leaves + augment](https://www.kaggle.com/code/jiweiliu/lgb-2-leaves-augment)

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.