eda-playbook
Runs a structured exploratory data analysis on a new or suspect dataset - schema audit, target analysis, feature profiling, missingness patterns, and leakage checks - ending in a written decision log. Use when someone says "I just got this dataset, where do I start", "my model metrics look too good", "audit this data before we model it", or is debugging unexpected model behavior. Do NOT use for writing the transformation code itself - use pandas-expert instead; for ongoing production data monitoring use data-quality; for constructing model features after EDA use ml-feature-engineering; for answering a one-off business question from a database use sql-to-insights.
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 25
- Forks
- 3
01 前言 Front Matter
- name
- eda-playbook
- metadata
- { "title": "EDA Playbook" }
- description
- Runs a structured exploratory data analysis on a new or suspect dataset - schema audit, target analysis, feature profiling, missingness patterns, and leakage checks - ending in a written decision log. Use when someone says "I just got this dataset, where do I start", "my model metrics look too good", "audit this data before we model it", or is debugging unexpected model behavior. Do NOT use for writing the transformation code itself - use pandas-expert instead; for ongoing production data monitoring use data-quality; for constructing model features after EDA use ml-feature-engineering; for answering a one-off business question from a database use sql-to-insights.
03 SKILL.md 正文
EDA Playbook
Skipping EDA before modeling is the single most common source of silent failures in ML pipelines: leakage that makes offline metrics fictional, structural missingness treated as random, a target definition nobody actually agreed on. This playbook is a fixed-order audit that surfaces those problems while they cost hours instead of quarters - and its output is a decision log, not a pile of plots.
Operating procedure
Run the sections in order: schema problems invalidate the target analysis, and the target definition must be pinned before any feature-target relationship means anything.
Step 1: gather inputs
- The dataset, its supposed grain (one row = ?), and the expected row count. If the provider cannot state either, derive them and label the result a guess.
- The target column and its written definition - precisely what event, over what window, measured when. Ambiguity here cascades everywhere; do not proceed on a verbal shrug.
- What information will exist at prediction time. This single fact powers every leakage check later.
- Any known collection changes (new form fields, pipeline migrations) that could create structural breaks.
Step 2: shape and schema audit
- Confirm row count is in the expected range; flag if off by orders of magnitude.
- Check every column dtype; coerce-or-drop mismatches before anything downstream (hand the coercion work to pandas-expert).
- List every column's null rate. Threshold: any column above 20% null gets an explicit handling decision in the log - no default treatment.
A compact audit that produces the whole table at once:
audit = pd.DataFrame({
"dtype": df.dtypes.astype(str),
"null_pct": (df.isna().mean() * 100).round(1),
"nunique": df.nunique(),
"modal_pct": (df.apply(lambda c: c.value_counts(normalize=True).iloc[0]) * 100).round(1),
})
print(audit.to_string())
Example output on a 5,000-row churn extract:
dtype null_pct nunique modal_pct
age float64 0.0 62 2.1
plan str 0.0 3 84.7
last_invoice_amt float64 30.5 3475 0.0
acct_flag float64 0.0 1 100.0
churned int64 0.0 2 92.4
Read it: last_invoice_amt at 30.5% null crosses the 20% line - decision required; acct_flag is a single constant value - near-zero variance, flag it; plan is 84.7% one value - usable but weak.
Step 3: target variable analysis
- Classification: class frequencies and the imbalance ratio. Above roughly 10:1, record now that accuracy is a meaningless headline metric and stratified splits are mandatory.
- Regression: plot the full distribution; compute skew and kurtosis; heavy right skew (skewness above ~2) puts a log/transform decision in the log.
- Identify implausible or out-of-range label values (negative durations, ages above 120) and trace them to source before excluding.
- Write the target definition into the log verbatim.
Step 4: univariate feature profiling
Profile independently before studying interactions:
- Numeric: min, max, mean, median, std, and the 1st/99th percentiles - the percentile gap versus min/max exposes outliers the std hides.
- Categorical: cardinality, top-5 values, modal frequency.
- Flag near-zero-variance features: std/mean below 0.01 for numerics; a single value covering more than 98% for categoricals.
- Do NOT drop anything yet - document and defer. Dropping during profiling destroys evidence the missingness analysis needs.
Step 5: missingness patterns
Random and structural missingness require different treatment, so diagnose before imputing:
- Compute a missingness correlation matrix (
df.isna().corr()). Columns missing together (correlation near 1.0) indicate a pipeline branch or a form version - investigate the source, do not impute across the break. - Test whether missingness correlates with the target; if it does, the missing indicator is itself a feature and MNAR is likely.
- MCAR vs MNAR usually cannot be proven - record the determination as an explicit assumption in the log when unverifiable.
Step 6: bivariate and leakage checks
Correlation with the target is useful; near-perfect correlation is an alarm:
- Any feature with Pearson or Spearman |r| above 0.95 against the target gets a leakage investigation before celebration - it is almost always a post-outcome column (refund amount predicting churn) or a target transform.
- Every timestamp-derived feature must be verified against the prediction-time inventory from Step 1: computed only from information available when the prediction is made.
- Identifiers (IDs, keys, hashes) are excluded from modeling features unless deliberately encoded - high-cardinality IDs memorize rows.
- Check duplicate rows and near-duplicates across a would-be train/test boundary; duplicates spanning the split inflate metrics.
Step 7: write the decision log
EDA output is only valuable if it drives decisions. For each flagged issue record: the finding, the decision (drop / impute / transform / flag / investigate upstream), and the rationale - not just the outcome. Treat the log as living; update it when modeling reveals new issues.
Worked artifact: decision log template
EDA DECISION LOG - [FILL: dataset] - [FILL: analyst]
Grain: one row = [FILL] Rows: [FILL] (expected: [FILL])
Target: [FILL: verbatim definition, window, measurement time]
Prediction-time inventory: [FILL: columns known at prediction time]
| # | Finding | Decision | Rationale |
|---|--------------------------------------|---------------------|----------------------------------|
| 1 | last_invoice_amt 30.5% null, | Impute 0 + missing | Nulls = never invoiced (free |
| | missing only where plan = free | indicator column | plan); structural, not random |
| 2 | acct_flag constant (1 value) | Drop | Zero variance, no signal |
| 3 | refund_amt r = 0.97 with churn | Drop - LEAKAGE | Populated after churn event |
| 4 | churned imbalance 12:1 | Stratify; use PR-AUC| Accuracy meaningless at 12:1 |
Deliverable
Produce a written EDA summary containing: dataset health at a glance (rows, grain, schema surprises), the verbatim target definition, the top risks ranked, and the decision log with one row per flagged issue - finding, decision, rationale. This document, not the notebook, is what the modeling work builds on.
Do NOT
- Do not start modeling with the EDA "mostly done" - the leakage check is the part that invalidates results, and it is always the part skipped.
- Do not impute before diagnosing missingness structure; imputing across a pipeline branch fabricates data.
- Do not drop features during profiling; defer every drop to the decision log.
- Do not accept a target definition by conversation; write it down and get it confirmed.
- Do not treat |r| > 0.95 with the target as a great feature; treat it as leakage until proven otherwise.
Quality bar
The EDA ships only when: every column appears in the audit table; every issue crossing a threshold (20% null, 98% modal, |r| > 0.95, 10:1 imbalance) has a logged decision with rationale; the target definition is written and confirmed; every timestamp feature is cleared against the prediction-time inventory; and a second analyst could act on the log without opening the notebook.
04 同仓库更多 Skills
zone-2-cardio-plan
Use when someone asks to build a steady-state cardio plan, train an aerobic base or Zone 2, structure easy or endurance weekly cardio, train by heart-rate zones, or improve resting heart rate, VO2, or endurance. Builds a heart-rate-zone aerobic training block with session structure, modality choice, and progression. General fitness guidance, not medical advice. Do NOT use to design a strength or lifting program (use Strength Training Plan), high-intensity interval conditioning, HIIT, or circuits (use Conditioning & HIIT Program), or a mobility/flexibility routine (use Mobility Routine).
youtube-script-writer
Writes retention-engineered long-form YouTube scripts on a hook/body/payoff architecture - a first-30-seconds hook that survives the retention cliff, a beat-sheet body with mini-hooks and bridges, timed pattern interrupts, and a payoff that over-delivers - with B-roll and editing cues marked inline. Use when someone says "script my next video", "my retention graph dies at the start", "tighten this draft", or "outline a video on X". Do NOT use for the 3-second opener of TikTok, Reels, or Shorts - use video-hook-writer instead; do NOT use for spoken voiceover synced to on-screen tutorial actions - use narration-script instead; do NOT use for a sales demo built on a buyer's discovery notes - use demo-script instead; do NOT use to design the thumbnail and title - use thumbnail-concept instead.
win-back-campaign
Designs segmented win-back email sequences for dormant users - dormancy tiers, a three-beat sequence with a single proportional incentive, and a suppression rule - and measures success by re-activation, not opens. Use when someone says "our users went quiet", "design a win-back campaign", "how do I re-engage lapsed customers", "should we email people who haven't logged in for months", or lifecycle messaging has stopped landing with a lapsed segment. Do NOT use for recovering an unfinished checkout - use abandoned-cart-sequence instead. Do NOT use for diagnosing and fixing why active customers cancel - use churn-reduction instead. Do NOT use for building always-on onboarding or nurture flows - use email-drip-builder instead.
wikipedia-style
Writes neutral, verifiable, encyclopedic prose following Wikipedia's core content policies and manual of style - NPOV, inline citations, notability-backed claims, and a strict ban on promotional language. Use when someone asks "write this like a Wikipedia article", "draft a Wikipedia page for this company or person", "make this neutral and encyclopedic", or "why does my article draft keep getting rejected". Do NOT use for persuasive or opinion writing - use op-ed-writer instead; for thesis-driven academic papers, use academic-essay; for verifying claims in existing text, use fact-checker.
whitepapers
Structures and writes authoritative B2B whitepapers - a standalone executive summary, a data-sized problem statement, methodology, evidence-driven findings, recommendations, and a soft call to action - flagging every claim that needs a real citation. Use when a marketer asks "write a whitepaper on this topic", "turn our research into a lead-gen asset", "make this credible enough for executives", or a draft reads like a product pitch instead of analysis. Do NOT use for customer-story-driven proof - use case-study-builder instead; for policy audiences, use policy-brief.
white-space-analysis
Finds unmet market gaps by ranking jobs-to-be-done on importance versus satisfaction, overlaying them against current solutions and workarounds, and validating that each gap is real, winnable, and worth winning. Use when someone asks "where are the gaps in this market", "what's underserved here", "where should we play next", or is hunting for product, feature, or market-entry opportunities. Do NOT use for profiling competitors and building battle cards - use competitive-intelligence instead; for putting a dollar figure on an identified opportunity - use market-sizing instead; for extracting jobs-to-be-done from raw customer interviews - use jtbd-extractor instead.