Probability to Log-Odds
Kestrel Freight's risk team works in odds rather than probabilities. Odds compare how likely something is against how likely it is not, so a probability of 0.8 is odds of four to one. Odds are awkward to add up, though — they run from nothing to infinity with the even-money point stranded at 1 — so the team takes the natural logarithm of them, which is called the log-odds. On that scale the even-money point sits at zero, twice as likely and half as likely are the same distance apart in opposite directions, and the evidence for a job can be added up piece by piece. It is also the scale the model's own score lives on: the log-odds of a probability is precisely the score the squashing curve was handed to produce it.
Task: Print the log-odds of this probability.
Input
One line holding a single number, a probability strictly between 0 and 1.
Output
One line holding the log-odds rounded to 4 decimal places, with no label. Use the natural logarithm. The answer is negative when the probability is below one half.
Example:
Input:
0.5
Output:
0.0000
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in