step-by-step through how the sigmoid function turns a logit into a probability, with both math and plain English at each step.
✅ Step 1: What is a logit?
The logit of a probability is defined as:
This is called the log-odds, because it’s the natural log of the odds.
✅ Step 2: What if we are given the logit and want to get the probability?
Let’s say we are given a number , and we know it’s a logit.
That means:
We want to solve for , the probability.
✅ Step 3: Exponentiate both sides
To get rid of the logarithm, we exponentiate both sides:
This tells us the odds in terms of .
✅ Step 4: Solve for
Now we solve this equation for .
Start with:
Multiply both sides by :
Distribute the left-hand side:
Now get all the 's on one side:
Factor out on the right-hand side:
Now divide both sides by :
✅ Step 5: Simplify into the sigmoid form
We now simplify that expression:
That’s the sigmoid function:
✅ Final Result
So if you’re given a logit value , the sigmoid function:
turns it into a probability .
🔁 Why this is useful
-
In logistic regression, we compute:
-
Then use the sigmoid to convert that score (logit) into a probability of class 1:
This way, the model’s output is interpretable as a probability — suitable for binary classification.
Let me know if you want a plot or visualization to make it even clearer!
No comments:
Post a Comment