Logistic log-loss function of one variable: Difference between revisions
No edit summary |
No edit summary |
||
| Line 18: | Line 18: | ||
<math>f(x) = p \ln(1 + e^{-x}) + (1 - p) \ln (1 + e^x)</math> | <math>f(x) = p \ln(1 + e^{-x}) + (1 - p) \ln (1 + e^x)</math> | ||
==Differentiation== | |||
===First derivative=== | |||
We use that: | |||
<math>g'(x) = g(x)(1 - g(x)) = g(x)g(-x)</math> | |||
or equivalently: | |||
<math>\frac{d}{dx} (\ln(g(x)) = 1 - g(x) = g(-x)</math> | |||
Similarly: | |||
<math>\frac{d}{dx} (\ln(g(-x)) = - g(x)</math> | |||
Plugging these in, we get: | |||
<math>f'(x) = -(p(1 - g(x)) + (1 - p)(-g(x)))</math> | |||
This simplifies to: | |||
<math>f'(x) = g(x) - p</math> | |||
===Second derivative=== | |||
Using the first derivative and the expression for <math>g'</math>, we obtain: | |||
<math>f''(x) = g(x)(1 - g(x)) = g(x)g(-x)</math> | |||
Revision as of 17:54, 12 September 2014
Definition
The logistic log-loss function of one variable is obtained by composing the logarithmic cost function with the logistic function, and it is of importance in the analysis of logistic regression.
Explicitly, the function has the form:
where is the logistic function and denotes the natural logarithm. Explicitly, .
Note that , so the above can be written as:
We restrict to the interval . Conceptually, is the corresponding probability.
More explicitly, is the function:
Differentiation
First derivative
We use that:
or equivalently:
Similarly:
Plugging these in, we get:
This simplifies to:
Second derivative
Using the first derivative and the expression for , we obtain: