Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

peiying410632
from peiying410632 More from this publisher
22.02.2024 Views

As expected, probabilities that add up to 100% (like 75% and 25%) correspond tolog odds ratios that are the same in absolute value. Let’s plot it:Figure 3.3 - Log odds ratio and probabilityOn the left, each probability maps into a log odds ratio. The red dots correspond toprobabilities of 25%, 50%, and 75%, the same as before.If we flip the horizontal and vertical axes (right plot), we are inverting the function,thus mapping each log odds ratio into a probability. That’s the function we werelooking for!Does its shape look familiar? Wait for it…From Logits to ProbabilitiesIn the previous section, we were trying to map logit values into probabilities, andwe’ve just found out, graphically, a function that maps log odds ratios intoprobabilities.Clearly, our logits are log odds ratios :-) Sure, drawing conclusions like this is notvery scientific, but the purpose of this exercise is to illustrate how the results of aregression, represented by the logits (z), get to be mapped into probabilities.Model | 215

So, here’s what we arrived at:Equation 3.7 - Regression, logits, and log odds ratiosLet’s work this equation out a bit, inverting, rearranging, and simplifying someterms to isolate p:Equation 3.8 - From logits (z) to probabilities (p)Does it look familiar? That’s a sigmoid function! It is the inverse of the log oddsratio.Equation 3.9 - Sigmoid function216 | Chapter 3: A Simple Classification Problem

As expected, probabilities that add up to 100% (like 75% and 25%) correspond to

log odds ratios that are the same in absolute value. Let’s plot it:

Figure 3.3 - Log odds ratio and probability

On the left, each probability maps into a log odds ratio. The red dots correspond to

probabilities of 25%, 50%, and 75%, the same as before.

If we flip the horizontal and vertical axes (right plot), we are inverting the function,

thus mapping each log odds ratio into a probability. That’s the function we were

looking for!

Does its shape look familiar? Wait for it…

From Logits to Probabilities

In the previous section, we were trying to map logit values into probabilities, and

we’ve just found out, graphically, a function that maps log odds ratios into

probabilities.

Clearly, our logits are log odds ratios :-) Sure, drawing conclusions like this is not

very scientific, but the purpose of this exercise is to illustrate how the results of a

regression, represented by the logits (z), get to be mapped into probabilities.

Model | 215

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!