Week 10 predicted a number: how many days each Summit Gear account takes to pay. This week the credit team asks a yes or no question about the same 2,200 accounts: will this account default? A model for a yes or no question should give back a probability, a number between 0 and 1, and logistic regression is a common way to estimate one. This page builds it in five steps: probability and odds, the curve that turns a score into a probability, reading the fitted coefficients, one account's probability, and the cutoff that turns a probability into a decision.
A probability p is a number from 0 to 1. 0 means it never happens, 1 means it always happens,
and 0.20 means a 20% chance. 438 of Summit Gear's 2,200 accounts defaulted, about 20%, so that share (the
base rate) is where a typical account starts.
Odds carry the same information written another way: the chance it happens divided by the chance it does not.
A probability of 0.20 is odds of 0.20 / 0.80 = 0.25, often said as 1 to 4: one default for every four accounts that do not default. A probability is boxed in between 0 and 1. Odds remove the ceiling, so they run from 0 up with no limit. Taking the log of the odds removes the floor as well, which gives the log-odds, a scale that runs from negative to positive with no limit at either end. Drag the slider and watch all three move together.
A logarithm answers a plain question: what power do you raise a base number to in order to reach this value?
With base 10, log(100) = 2 because 10 × 10 = 100. Logistic regression uses the natural log,
written ln, which asks the same question with the fixed number e ≈ 2.718 in place of 10. The
base does not change the idea.
Three facts are all you need here. The log of 1 is exactly 0. The log of a number bigger than 1 is positive. The log of a number between 0 and 1 is negative. So an account less likely to default than not (odds below 1) lands on a negative log-odds, an even-money account (odds of 1) lands on 0, and an account more likely to default lands on a positive number.
p directly.
It predicts the log-odds, because the log-odds can be any number, positive or negative, which is what a sum of
coefficient × predictor terms produces. The model works in log-odds and converts back to a probability at the end.
That conversion is the sigmoid, in step 2.Credit puts an account's probability of default at 0.25. What are its odds of default? Type a number. A fraction such as 2/5 works too.
The model adds up intercept + coefficient₁ × x₁ + coefficient₂ × x₂ + ...
into one number called the score z. The score is the log-odds, so it can be anything from deeply
negative to deeply positive. The sigmoid function bends that whole range into the 0 to 1 band a probability lives in:
When z = 0 the probability is exactly 0.5. A large positive score pushes p toward 1, and a
large negative score pushes it toward 0. It never quite reaches either end, which gives the S shape. Move z
and watch the dot ride the curve.
p is at or above the cutoff, otherwise let it through. Many
tools use 0.5 unless you set something else, though a better cutoff usually depends on what each kind of mistake costs.
You set a cutoff in step 5, and the next page, the cutoff and cost trainer, shows how to choose one.Here is a logistic regression already fitted on the Summit Gear table, target defaulted (1 if the
account's receivable was written off as uncollectible). It is the deck's model: four predictors, fit on 1,760 of the
accounts, with the other 440 held back so it can be tested on accounts it never saw (step 5). This step reads the fitted
coefficients the way you would read output a colleague or an AI assistant hands you.
A coefficient is the change in the log-odds of default for a one-unit rise in that predictor, holding the other
predictors fixed. Raise e to the coefficient, exp(coefficient) in Python or =EXP()
in Excel, and you get the odds ratio: the number the odds get multiplied by for that one-unit rise. Above 1 raises
the odds of default, below 1 lowers them, and exactly 1 means no change.
| predictor | coefficient | odds ratio per unit | a realistic change: odds multiplied by |
|---|---|---|---|
| Loading the model | |||
The bars show what the realistic change in the last column does to the odds, on a scale where 1 means no change. Bars to the right raise the odds of default, bars to the left lower them.
If you took an earlier analytics course that read logistic coefficients as marginal effects (the change in probability for a one-unit rise), both readings are valid. This course uses odds ratios because one number holds for every account, while a marginal effect changes with where the account sits on the curve. These are point estimates from one sample, so an odds ratio close to 1 may not be distinguishable from no effect. Read the direction and the rough size, and check the p-value column in the full output before leaning on a small one.
Pick values for the four columns and watch the model build this account's probability. The score starts at the intercept, and each predictor adds its coefficient times its value. The sigmoid then turns the score into a probability. The sliders start at the median account: the middle value of each column across the 1,760 training accounts.
Loading the model.
The model gives every account a probability. Credit needs a yes or no: review this account before its next order ships on terms, or let it through. A cutoff turns one into the other: flag an account for review when its probability is at or above the cutoff. The slider starts at 0.5 because many tools use it unless you set something else, and the next page shows how the cost of each kind of mistake can move the cutoff away from it.
These are the 440 held-out accounts, the ones the model never saw while it was fit. Each square is one account, placed by its predicted probability. Accounts that did not default sit above the axis and accounts that defaulted sit below it. Move the cutoff and every square to its right is flagged. The color says which cell of the confusion matrix (the table of right and wrong calls) the account lands in.
One or two sentences on prior_late_count, in your own words, for a credit analyst. Say what the odds
ratio multiplies, by about how much, and what is held fixed. The check below is a fixed set of rules, not a grade, and
the tutor will ask you to try before it confirms a reading.