stratified-quota-sampling

Balance class-imbalanced datasets with Box-Cox normalization and Fibonacci-family quotas.

Updated Apr 20, 2026
One-click install
npx skills add https://github.com/thistleknot/skills --skill stratified-quota-sampling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stratified-quota-sampling
Source: https://github.com/thistleknot/skills/tree/main/stratified-quota-sampling
Command: npx skills add https://github.com/thistleknot/skills --skill stratified-quota-sampling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of imbalanced, long-tailed datasets where naive sampling either floods frequent classes or starves rare classes, leading to distorted training and weak coverage.

Core Features & Use Cases

  • Box-Cox normalization to reshape raw per-class counts toward near-normality.
  • Tier binning at ±1σ to create LOW/MID/HIGH strata from the data’s empirical distribution.
  • Fibonacci-style quota allocation (5/8/13) to scale selection sublinearly for head classes while preserving rare-class presence.
  • Relevance-weighted sampling within each class/tier to prefer higher-quality items while still maintaining coverage.

Use it when you need balanced representation under a fixed budget—such as text corpora by document length, image datasets by class frequency, sparse entity coverage in hierarchical corpora, or any setting where rare categories must remain visible.

Quick Start

Use stratified-quota-sampling to pick a balanced subset by passing your {class_name: [items]} map, setting the item relevance field as weight_key, and choosing a reproducible seed for deterministic draws.

Frequently Asked Questions about stratified-quota-sampling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I balance a long-tailed dataset without losing rare class representation?

To balance a long-tailed dataset without losing rare classes, stratified quota sampling normalizes per-class counts with Box-Cox, bins classes into LOW/MID/HIGH tiers at ±1σ, and allocates Fibonacci-family quotas to scale selection sublinearly while preserving rare-class presence.

What's the best way to sample a fixed-budget subset from an imbalanced corpus?

The best way to sample a fixed-budget subset from an imbalanced corpus is to apply relevance-weighted sampling within Box-Cox normalized tiers, ensuring higher-quality items are preferred while maintaining coverage across skewed class frequency distributions.

Can I get reproducible results when sampling from class-imbalanced data?

Yes, reproducible results are possible when sampling from class-imbalanced data by setting a deterministic seed, which ensures the same subset is drawn from the Box-Cox normalized and Fibonacci-quota-allocated tiers every time.

How does Box-Cox normalization help with class imbalance in dataset sampling?

Box-Cox normalization helps with class imbalance by reshaping raw per-class counts toward near-normality, which allows accurate z-score derivation for assigning classes into LOW, MID, and HIGH strata before quota allocation.

Does this stratified sampling approach work for sparse entity coverage in hierarchical corpora?

Yes, this stratified sampling approach works for sparse entity coverage in hierarchical corpora by applying per-item relevance weights within each class tier, ensuring rare categories remain visible under a fixed selection budget.

Why do naive sampling methods starve rare classes in long-tailed datasets?

Naive sampling methods starve rare classes in long-tailed datasets because they either flood frequent classes or starve rare classes, leading to distorted training and weak coverage, whereas Fibonacci-style quota allocation scales selection sublinearly to prevent this.