起源故事 · 从人口曲线到分类基石
Origin Story · From a Population Curve to a Classification Bedrock
那条 S 形曲线最早由比利时数学家 Verhulst 在 1838 年用来描述人口增长 —— 起步慢、中间猛、到顶趋缓。
1944 年统计学家 Joseph Berkson 把它请进回归,造了 logit 这个词,专门处理"是 / 否"型结果。
它最聪明的一步是换个尺度:不直接预测概率,而是预测"对数几率 logit(p)",让这个新尺度可以从 −∞ 到 +∞ 自由地走直线,
再用 sigmoid 把它折回 0~1。今天从银行风控到 AI 分类器,逻辑回归仍是最被信赖的起点模型。
The S-curve was first written down in 1838 by the Belgian mathematician Verhulst to describe how populations grow — slow start, steep middle, leveling off at the top.
In 1944 the statistician Joseph Berkson brought it into regression and coined the term logit, purpose-built for yes/no outcomes.
Its smartest move is a change of scale: instead of predicting probability directly, it predicts the log-odds (logit(p)), which is free to roam from −∞ to +∞ along a straight line —
then sigmoid folds it back into 0–1. From bank risk engines to modern AI classifiers, logistic regression is still the most trusted starting model in classification.
1 S 曲线:把无界的输入压进 0~1 The S-Curve: Squeezing Unbounded Input Into 0–1
调一调试试tune it2 幕后:在 logit 尺度上,它就是一条直线 Behind the Scenes: On the Logit Scale, It's Just a Line
把纵轴从"概率"换成"对数几率 logit(p)=ln(p/(1−p))",那条扭来扭去的 S 曲线就瞬间变直。 这就是逻辑回归的魔法:在 logit 尺度上做普通的线性回归,再变回概率。 Swap the y-axis from probability to log-odds logit(p) = ln(p / (1 − p)) and the twisting S-curve snaps straight. That's the magic of logistic regression: do ordinary linear regression on the logit scale, then convert back into probability.
3 现实里的逻辑回归 Logistic Regression in the Real World
信用违约预测:用收入、负债、历史预测违约概率,是银行风控评分卡的核心。
Credit default: predict default probability from income, debt, and history — the engine inside every bank's credit scorecard.
客户流失:根据使用频率、投诉次数预测客户会不会走,提前挽留。
Customer churn: use usage frequency and complaint counts to predict who's about to leave, so retention can step in early.
疾病风险:年龄、血压、指标预测患病概率,医学诊断与筛查的常用模型。
Disease risk: convert age, blood pressure, and lab values into a probability of disease — a staple of clinical diagnosis and screening.
合格 / 报废:用工艺参数预测产品是否合格,质量分类与缺陷预警。
Pass / scrap: predict whether a unit will pass from its process parameters — defect early-warning and quality classification.
一句话In One Line
线性回归的输出可以是任意实数,但"概率"天生被关在 0 到 1 之间 —— 这是个根本矛盾。
逻辑回归用 sigmoid 这把"软夹子"优雅地化解:无论输入多大多小,输出永远落在 0~1。
它的系数也别有洞天 —— β₁ 不直接说概率,而说"x 每加 1,发生的几率(odds)乘以 e^β₁",这就是几率比。
看懂这一层,你就理解了为什么它是几乎所有二分类任务的起手式。
Linear regression's output is any real number, but probability is permanently locked between 0 and 1 — a fundamental conflict.
Logistic regression resolves it elegantly with sigmoid, a "soft clamp": no matter how large or small the input, the output always lands in 0–1.
Its coefficients have a second layer of meaning — β₁ doesn't speak in probability, it speaks in odds: "each +1 in x multiplies the odds of the event by e^β₁" — that's the odds ratio.
Once you see this, you understand why it's the opening move for almost every binary-classification problem.
常见误用Common Mistakes
对"是 / 否"硬用线性回归。概率会越界,必须用逻辑回归约束在 0~1。
Forcing linear regression onto yes/no outcomes. Probabilities will overshoot — use logistic regression to constrain them inside 0–1.
把 β₁ 当成"概率增量"解读。β₁ 是对数几率的变化,e^β₁ 才是几率比。
Reading β₁ as a change in probability. β₁ is the change in log-odds — exponentiate it (e^β₁) to get the odds ratio.
类别极不平衡仍只看准确率。99% 是阴性时准确率会骗人,要看召回 / AUC。
Trusting accuracy on a heavily imbalanced dataset. When 99% of cases are negative, accuracy lies — lean on recall and AUC instead.