logistic-regression
Skill0 starsChanged 6 months agoMITView on GitHub
Fits, evaluates, and interprets logistic regression for binary outcomes (churn, conversion, fraud, adoption). Use when the user mentions logistic regression, binary outcome, churn modeling, conversion prediction, propensity model, odds ratio, classification, AUC, or asks "what predicts X" where X is yes/no.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- WindcleaverDev/regkittheir own version, first seen Jun 13, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- WindcleaverDev/regkit★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- ab-test-analysisSkill
- ab-test-designSkill
- causal-inferenceSkill
- cohort-analysisSkill
- data-quality-auditSkill
- funnel-analysisSkill
- linear-regressionSkill
- metric-definitionSkill
- modular-sql-ctesSkill
- sql-correctness-reviewSkill
- sql-query-reviewSkill
- stakeholder-readoutSkill
- survival-analysisSkill
- warehouse-query-optimizationSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 10
Use for binary outcome prediction where interpretability matters as much as accuracy.
- Very specific: line 54
Fit baseline: Start with regularized logistic (LogisticRegression(C=1.0, penalty='l2') in sklearn).
- Distinctive: line 64
If false negatives cost 10× false positives → lower threshold
- Distinctive: line 66
Default to 0.5 only if cost is symmetric (rare in practice)
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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
Logistic Regression
When to use this skill
Use for binary outcome prediction where interpretability matters as much as accuracy. Triggers:
- "Model churn / conversion / fraud / adoption"
- "Predict probability of X"
- "Build a propensity model"
- "What predicts
<binary outcome>?" - "Logistic regression for…"
For complex non-linear interactions, suggest a tree-based model after fitting logistic as the baseline. For continuous outcomes, use linear-regression. For time-to-event, use survival-analysis.
Required inputs
| Input | Why it matters |
| Binary target | What you're predicting (must be 0/1 or boolean) |
| Feature set | Predictors, with clear definitions |
| Observation grain | Per user / per session / per opportunity |
| Time cutoffs | Feature window must end BEFORE outcome window starts (leakage check) |
| Train/test strategy | Temporal split for production models, random split for exploratory |
Workflow
- Audit the data first (use
data-quality-auditskill). - Check class balance.
print(y.value_counts(normalize=True))- Balanced (40-60%): standard logistic
- Mild imbalance (10-40%): use
class_weight='balanced'and look at PR-AUC, not ROC-AUC alone - Severe (< 5%): consider downsampling, but always evaluate calibration on the original distribution
- Verify no leakage. The most common DS bug. Ask:
- Is any feature derived from data after the prediction time?
- Is the target ever used to build features?
- Are there features that are only defined for positives?
- Split data temporally.
Random splits are only acceptable for exploratory analysis.train = df[df['as_of_date'] < cutoff] test = df[df['as_of_date'] >= cutoff] - Fit baseline. Start with regularized logistic (
LogisticRegression(C=1.0, penalty='l2')in sklearn). - Evaluate on holdout:
- AUC-ROC (ranking quality)
- AUC-PR (for imbalanced classes)
- Brier score (calibration)
- Calibration curve (visualize predicted vs observed probability)
- Confusion matrix at the operating threshold
- Choose threshold based on business cost.
- If false negatives cost 10× false positives → lower threshold
- Plot precision-recall vs threshold to find the inflection
- Default to 0.5 only if cost is symmetric (rare in practice)
- Interpret coefficients as odds ratios.
odds_ratio = exp(beta) "A 1-unit increase in X multiplies the odds of Y by <odds_ratio>" - Write the readout with the structure below.
Output format
# Logistic Regression: <outcome>
## Setup
- **Outcome:** <binary_target> (positive class = <description>, base rate = <X%>)
- **Observation unit:** <user_id> as of <as_of_date>
- **Sample size:** <N_train> train, <N_test> test (temporal split at <date>)
- **Features:** <N> features (<categories>)
## Performance (test set)
| Metric | Value | Notes |
|---|---|---|
| AUC-ROC | 0.78 | Solid ranking |
| AUC-PR | 0.34 | Base rate 0.08 (random baseline = 0.08) |
| Brier score | 0.072 | |
| Calibration | well-calibrated below 0.4, slight underprediction above | see plot |
| Threshold @ 0.30 | precision 0.42, recall 0.61, F1 0.50 | chosen for business cost |
## Top coefficients (sorted by absolute effect)
| Feature | Coef (β) | Odds Ratio | Interpretation |
|---|---|---|---|
| days_since_last_login | +0.082 | 1.085 | +1 day → +8.5% odds of churn |
| support_tickets_30d | +0.610 | 1.840 | +1 ticket → +84% odds |
| has_active_subscription | -1.420 | 0.242 | active sub → -76% odds |
| ... | | | |
## Calibration check
<observed vs predicted probability table, by decile>
| Decile | Predicted | Observed | n |
|---|---|---|---|
| 1 (lowest) | 0.012 | 0.014 | 1,240 |
| 5 (middle) | 0.103 | 0.108 | 1,240 |
| 10 (highest) | 0.612 | 0.587 | 1,240 |
## Operational impact at chosen threshold
- Flag rate: <X%> of users
- Precision: <X%> (of flagged, correctly identified)
- Recall: <X%> (of true positives, caught)
- Estimated business impact: <e.g., "If we contact all 5,200 flagged users this month, we expect to retain 460 (lift over no-action: +180 retained)">
## Caveats
- <e.g., model trained on stable period; performance may degrade if user base shifts>
- <e.g., features 1-3 require real-time computation; ensure pipeline supports>
- Calibration may drift; re-evaluate quarterly.
## Next steps
- <e.g., A/B test intervention on flagged users>
- <e.g., monitor model performance over next 30 days>
- <e.g., consider tree-based model if interaction terms become important>Validation checks
- No leakage: every feature is provably computed before the outcome window
- Temporal split used (or justified random split)
- Calibration checked, not just AUC
- Threshold chosen based on stated business cost
- Odds ratios reported (more interpretable than raw β)
- Operational impact estimated, not just statistical metrics
Edge cases & failure modes
- Perfect separation: one feature perfectly predicts outcome. Coefficient explodes. Usually a leakage bug.
- Multicollinearity: correlated features inflate individual coefficient variance. Use VIF check or regularization.
- Very rare class (< 1%): AUC-ROC is misleading. Use AUC-PR. Consider gradient boosting instead.
- Categorical with many levels: one-hot encoding explodes dimensions. Use target encoding or merge rare categories into "other."
- Calibration drift: model AUC stable but threshold-based decisions degrading. Re-calibrate with Platt scaling or isotonic regression every 3-6 months.
Scripts
scripts/fit_logistic.py— End-to-end fit + evaluate + report from a CSV.
python scripts/fit_logistic.py \
--input training_data.csv \
--target churned \
--features feature_list.txt \
--split-by signup_date \
--split-date 2026-03-01Related skills
data-quality-audit— always run on inputs firstlinear-regression— for continuous outcomessurvival-analysis— when timing matterscausal-inference— if you need to estimate intervention effect, not just predictstakeholder-readout— for packaging the model output
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.

