💻 Coding

Data Science Prompt: EDA Plan, Features, and Model Checks

Turn a dataset and a question into a data science plan: EDA checks, leakage flags, feature ideas, a baseline, the right metric, and a validation split.

0.0
0Reviews
P
October 17, 2026

Prompt

Act as a senior data scientist who turns a dataset description and a business question into a working analysis plan: exploratory data analysis (EDA) checks, leakage risks, feature ideas, a baseline model, the right metric, and a validation split, with pandas and scikit-learn code stubs I can run on my own data.

Inputs:
- The business question and the decision it will drive: [Question]
- Dataset: rows, time span, and the column list with types: [Columns]
- Summary stats or df.describe() / df.info() output I pasted: [DataSummary]
- The target column and how it is defined: [Target]
- When each column becomes known relative to the prediction moment: [Timing]
- Tools and limits (Python version, libraries, compute, deadline): [Stack]

Generate:
1. Problem framing: restate Question as a prediction or analysis task, the unit of prediction, and when the prediction is made.
2. EDA checklist: missing values, duplicates, target balance, outliers, and time trends to check, each with a short pandas snippet.
3. Leakage flags: every column in Columns that may be known only after the prediction moment (from Timing), with keep, drop, or "confirm with the data owner".
4. Feature ideas: 5 to 8 features built only from columns known in time, each with a one-line reason.
5. Baseline and model: a simple baseline to beat, then one model to try first, with a scikit-learn pipeline stub.
6. Metric and validation: the metric that matches the decision (and why accuracy may mislead), plus a split that respects time if the data has it.
7. Results template: the table I should fill in after running the code. Leave every number blank.

Rules:
- Never invent results, scores, or data values. Use only what is in DataSummary.
- Mark assumptions clearly and list the questions to ask the data owner.
- Code must run on the column names I gave; no made-up columns.

Instructions

Describe your business question, columns with types, summary stats, the target, and when each column becomes known. Run the snippets on your own data and fill in the results table yourself. Confirm any leakage flag with the person who owns the data. Do not paste raw rows, customer IDs, or other personal or confidential data; share column names, types, and summary stats only. Report only results you computed yourself.

Generated Output

This image was generated using the prompt above.

Data Science Prompt: EDA Plan, Features, and Model Checks - Result

Examples

Example Input

Question: which subscribers are likely to cancel next month, so the retention team can call the top 200 each month
Columns: 48,000 rows, one per subscriber per month, Jan 2025 to Aug 2026; customer_id (str), month (date), plan (cat: basic, plus, pro), monthly_fee (float), tenure_months (int), logins_30d (int), support_tickets_30d (int), discount_applied (bool), cancel_reason (str), churned_next_month (0/1)
DataSummary: churned_next_month mean 0.07; logins_30d missing 4%; cancel_reason missing 93%; monthly_fee min 0.0, max 49.0
Target: churned_next_month = 1 if the subscriber cancels in the following calendar month
Timing: all columns are known at the end of each month except cancel_reason, which support fills in when a subscriber cancels
Stack: Python 3.11, pandas, scikit-learn, laptop only, first readout in one week

Example Output

1. PROBLEM FRAMING
Binary classification. Unit: one subscriber-month. Prediction made at the end of each month for the next calendar month. Output: a ranked list so the retention team can call the top 200.

2. EDA CHECKLIST
- Missing values: df.isna().mean().sort_values() (logins_30d is 4% missing; decide fill vs flag)
- Duplicates: df.duplicated(["customer_id","month"]).sum()
- Target balance: df["churned_next_month"].mean() (summary says 0.07, so classes are imbalanced)
- Fee of 0.0: df[df.monthly_fee == 0].plan.value_counts() (free months or data errors? ask the data owner)
- Time trend: df.groupby("month").churned_next_month.mean().plot()

3. LEAKAGE FLAGS
- cancel_reason: DROP. It is filled in only when a subscriber cancels, so it reveals the target.
- discount_applied: confirm with the data owner. If discounts are given as a save offer after a cancel request, it leaks.
- All other columns: keep (known at month end per Timing).

4. FEATURE IDEAS
- logins_30d trend: change vs the subscriber's previous month (drop in use often comes before canceling)
- logins_30d missing flag (missing may itself mean low use)
- support_tickets_30d > 0 flag
- tenure bucket: 0-2, 3-6, 7-12, 13+ months
- plan and monthly_fee together: fee relative to the plan's usual fee
- months since last discount (if discount_applied is kept)

5. BASELINE AND MODEL
Baseline: rank by lowest logins_30d. Model: logistic regression, then gradient boosting if time allows.
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LogisticRegression
num = ["monthly_fee","tenure_months","logins_30d","support_tickets_30d"]
cat = ["plan"]
pre = ColumnTransformer([
  ("num", Pipeline([("imp", SimpleImputer(strategy="median", add_indicator=True)), ("sc", StandardScaler())]), num),
  ("cat", OneHotEncoder(handle_unknown="ignore"), cat)])
model = Pipeline([("pre", pre), ("clf", LogisticRegression(max_iter=1000, class_weight="balanced"))])

6. METRIC AND VALIDATION
With about 7% churn, accuracy can look high while missing most churners. Since the team calls 200 per month, measure precision in the top 200 each month (and recall in the top 200), plus PR-AUC. Split by time: train on Jan 2025 to Feb 2026, validate on Mar to May 2026, test on Jun to Aug 2026. Never split randomly across months, and keep each month's prediction using only that month's data.

7. RESULTS TEMPLATE
| Model | PR-AUC | Precision@200 | Recall@200 | Notes |
| Baseline (lowest logins) | | | | |
| Logistic regression | | | | |
| Gradient boosting | | | | |
Questions for the data owner: when is discount_applied set; what does a monthly_fee of 0.0 mean.

Reviews (0)

Please login to leave a review.
Loading reviews...