retail-eda-framework
Skill5 starsChanged 35 days agoMITView on GitHub
Comprehensive EDA approach for retail/fashion/tabular ML using best-in-class libraries. Use during stage 1 (data understanding) of any ML pipeline. Built around 5-stage pipeline: (1) data quality with ydata-profiling + missingno, (2) statistical profiling with sweetviz, (3) domain-specific (RFM, transaction patterns, co-occurrence), (4) time-series with tslumen, (5) summary. Validated on H&M Personalized Fashion Recommendations (105K articles, 25 cols, 0.39% missing — extremely clean).
- Installs packages
In this repository63 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adversarial-validation-kaggleSkill
- agent-nurture-frameworkSkill
- agent-session-memory-protocolSkill
- arxiv-paper-searchSkill
- autogluon-firstSkill
- autogluon-preset-strategySkill
- autogluon-timeseries-strategySkill
- catboost-first-tabularSkill
- claudeceptionSkill
- code-competition-artifact-pipelineSkill
- competition-orchestration-multimodelSkill
- context-engineeringSkill
- controlled-submission-experimentSkill
- cross-competition-feature-transferSkill
- cv-lb-gap-acknowledgmentSkill
- domain-knowledge-constraints-trapSkill
- ensemble-model-correlation-trapSkill
- feature-engineering-saturation-detectionSkill
- gpu-readiness-assessmentSkill
- gsd-loop-engineeringSkill
- kaggle-cognitive-cost-optimizationSkill
- kaggle-competition-best-practicesSkill
- kaggle-competition-type-strategySkill
- kaggle-data-format-firstSkill
- kaggle-discussion-searchSkill
- kaggle-experiment-sopSkill
- kaggle-oof-lb-validation-protocolSkill
- kaggle-optimal-blendingSkill
- kaggle-submission-format-by-metricSkill
- kaggle-top-performer-replicationSkill
- knowledge-crystallization-feedback-loopSkill
- ladder-drift-and-meta-aware-regressionSkill
- learned-value-beats-heuristic-augmentationSkill
- llm-competition-pipelineSkill
- mcts-pipeline-searchSkill
- mem0-dynamic-graph-memorySkill
- memory-hierarchy-managementSkill
- ml-sweet-spot-principleSkill
- model-ensemble-negative-weight-effectSkill
- multi-agent-rolesSkill
- multi-level-aggregation-overfittingSkill
- okf-visualize-knowledgeSkill
- onnx-minimal-network-designSkill
- per-category-modeling-backfireSkill
- progressive-verification-debuggingSkill
- ptcg-2ply-bounded-searchSkill
- ptcg-bc-large-model-submissionSkill
- rmsle-zero-threshold-asymmetrySkill
- runtime-reflexionSkill
- sc-tir-mathematical-reasoningSkill
- self-evolving-skillsSkill
- skill-governance-and-automationSkill
- spatiotemporal-graph-feature-engineeringSkill
- store-sales-darts-chronos-blendSkill
- tabular-polynomial-features-breakthroughSkill
- three-layer-wisdom-extractionSkill
- time-series-walk-forward-validationSkill
- trueskill-simulation-competition-strategySkill
- ts-day-specific-forecastingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Only 416 missing values (0.39% in detail_desc)
- Very specific: line 150
Data Quality: Only 416 missing (0.39% in detail_desc) — extremely clean
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Retail/Fashion EDA Framework
Comprehensive EDA approach for retail/fashion/tabular data, validated through Walmart, H&M, and 7+ fashion-lifecycle-pricing competitions.
Problem
Most ML projects skip EDA or do it superficially (just df.describe() + a histogram).
This leads to:
- Missing data issues discovered too late
- Train/test distribution shift not caught
- High-cardinality features used as raw categoricals (overfit)
- Text features not extracted from product descriptions
- Time-based leakage in train/test split
- Hierarchical structure ignored (e.g., 5-level category hierarchy in H&M)
Real case (validated 2026-06-02 on H&M articles.csv):
- 105,542 rows × 25 cols
- Only 416 missing values (0.39% in
detail_desc) - 5-level hierarchical structure: index_group → section → department → product_type → product_group
- 45,875 unique
prod_name(high cardinality) - 43,404 unique
detail_desc(text, 142 chars avg)
Without proper EDA, none of these are caught before feature engineering.
The 5-Stage EDA Pipeline
Stage 1: Data Quality Audit (FIRST)
Tools: ydata-profiling (13.5k★), missingno (4.2k★)
# Quick data quality report
import ydata_profiling
profile = ydata_profiling.ProfileReport(df, title="Data Quality Report")
profile.to_file("eda/data_quality.html")
# Missing data visualization
import missingno as msno
msno.matrix(df) # Bar chart of missing per column
msno.heatmap(df) # Correlation of missingness between columns
msno.dendrogram(df) # Hierarchical clustering of missingnessLook for:
- Missing value patterns (random vs systematic)
- High-cardinality categoricals (will overfit tree models)
- Skewed numerical features (need log transform)
- Constant/quasi-constant features (drop immediately)
- Duplicate rows
- Outliers (use IQR or z-score, not just visual)
Stage 2: Statistical Profiling (Train vs Test)
Tools: sweetviz (3.1k★)
# Compare train vs test
import sweetviz as sv
report = sv.compare([train_df, "Train"], [test_df, "Test"], target_feat="target")
report.show_html("eda/train_vs_test.html")Look for:
- Train/test distribution shift
- Per-segment behavior differences
- Data leakage (test features in train)
- Time-based trends (if applicable)
Stage 3: Domain-Specific EDA
For retail/fashion, focus on:
| Pattern | Tools | What to look for |
| Customer segmentation | RFM analysis | Recency, Frequency, Monetary quintiles |
| Transaction patterns | pandas, seaborn | Basket size, frequency, time-of-day, day-of-week |
| Article co-occurrence | custom ItemCF | Items bought together, substitute/companion |
| Fashion seasonality | statsmodels, tslumen | Year-over-year, holiday effects |
| Cold start analysis | pandas | % test customers with no history, % new articles |
| Inventory/availability | groupby, time series | Stockouts, restock patterns |
Stage 4: Time-Series EDA (if applicable)
Tools: tslumen (72★, HSBC-maintained), statsmodels
# For sales forecasting competitions
import tslumen
tslumen.from_ts(df.set_index('date')['sales']).plot()
# Decomposition, ACF/PACF, stationarity testsLook for:
- Trend / seasonality / residual decomposition
- Stationarity (ADF test)
- Autocorrelation structure (ACF/PACF)
- Holiday/special-event effects
- Data frequency consistency (missing weeks, etc.)
Stage 5: EDA Summary
Auto-generated eda/EDA_SUMMARY.md with:
- Files generated checklist
- Manual review items
- Next-step recommendations
Top EDA Library Recommendations (2026-06-02)
| Library | Stars | Use for | Install |
ydata-profiling | 13.5k | Comprehensive 1-line EDA report | pip install ydata-profiling |
great_expectations | 11.5k | Data quality + unit tests for data | pip install great_expectations |
visidata | 9.1k | Terminal-based interactive exploration | pip install visidata |
lux | 5.4k | Auto-viz on dataframe print | pip install lux-api |
missingno | 4.2k | Missing data visualization | pip install missingno |
sweetviz | 3.1k | Compare train vs test | pip install sweetviz |
dataprep | 2.2k | Low-code data prep + EDA | pip install dataprep |
AutoViz | 1.9k | 1-line automatic viz | pip install autoviz |
tslumen | 72 | Time-series specific EDA | pip install tslumen |
| RFM analysis | 41 | Customer segmentation | pip install rfm-analysis |
Common EDA Mistakes (Anti-Patterns)
- ❌ Skipping EDA to save time → always leads to feature engineering errors
- ❌ Only looking at summary statistics → miss distribution shape
- ❌ Ignoring train/test distribution shift → catastrophic in production
- ❌ Not checking missingness correlation → indicates systematic missingness
- ❌ Assuming all categorical = independent → categories may be related
- ❌ Forgetting to check time-based leakage → future data in training
- ❌ Not visualizing outliers → they may be valid (e.g., luxury items)
- ❌ Treating all features equally → ID-like features need special handling
Real Case: H&M Personalized Fashion Recommendations
Data: articles.csv (105,542 rows × 25 cols)
Date: 2026-06-02
EDA Findings
- Data Quality: Only 416 missing (0.39% in
detail_desc) — extremely clean - Hierarchical structure: 5 levels (index_group → section → department → product_type → product_group)
index_group_name(5 unique): Ladieswear, Menswear, Baby/Children, Sport, Divideddepartment_name(250 unique)product_type_name(131 unique)
- Top product types: Trousers (11K), Dress (10K), Sweater (9K)
- Top colors: Black (22K), Blue (18K), White (12K) — top 5 = 67% of articles
- Text features:
prod_name45,875 unique,detail_desc43,404 unique (mean 142 chars) - Data quality issues:
- Some numerical cols have
-1values (treat as NaN) article_idis large numeric (use as index only, not as feature)
- Some numerical cols have
Recommendations for Feature Engineering
- Hierarchy-based target encoding — 5 levels perfect for tree models
- Text features from
detail_desc— 142 chars avg, ideal for embeddings - Color groupings — reduce 50 colors to 10-15 effective groups
- Product variant detection —
product_codeshared across variants - Time-aware features — article age, recent sales velocity, seasonality
How to Apply
Option 1: Use the existing pipeline (recommended)
The ml-agent-code-template includes a pre-built EDA pipeline:
# Install dependencies
pip install ydata-profiling missingno sweetviz
# Run the pipeline
bash ml-agent-code-template/.claude/hooks/eda_pipeline.sh <data.csv>
# With optional flags
bash ml-agent-code-template/.claude/hooks/eda_pipeline.sh <data.csv> \
--segment=customer_type --time-series=dateOption 2: Manual invocation
import ydata_profiling
import missingno as msno
import sweetviz as sv
# Stage 1
profile = ydata_profiling.ProfileReport(df, title="Data Quality Report", minimal=True)
profile.to_file("eda/data_quality.html")
# Stage 2
report = sv.compare([train, "Train"], [test, "Test"], target_feat="target")
report.show_html("eda/train_vs_test.html")Related Skills
adversarial-validation-kaggle— for distribution shift detectionkaggle-data-format-first— for understanding schemakaggle-top-performer-replication— for 1st place feature analysis
Empirical Evidence
MLE-Bench experiments:
- Spaceship Titanic Gold: 0.8506 — EDA revealed
Cabinsplit into deck/side/num was key - Jigsaw Toxic Gold: 0.98829 — EDA on per-label distribution identified imbalance
- TPS May Silver: 0.99754 — EDA on f_27 string structure drove feature breakthrough
fashion-lifecycle-pricing:
- H&M R27 (best, Priv 0.02314): 27 experiments preceded by proper EDA
- Walmart R08 (best, LB=2720): EDA on MarkDown missing patterns + seasonality
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

