log_expit#

scikitplot.experimental._cy_experimental.log_expit(x0)#

Compute the natural logarithm of the sigmoid (expit) of a scalar input.

The function is defined as:

\[\log\_\operatorname{expit}(x) = -\log\left(1 + e^{-x}\right)\]

This transformation is commonly used when working with log-probabilities or in numerically stable implementations of logistic functions.

Parameters:
x0dfg_number_t

Scalar input value. Can be of type float, double, or long double.

Returns:
dfg_number_t

The log-sigmoid of the input value, returned with the same type as x0.

See also

expit

The sigmoid function.

logit

The inverse sigmoid (log-odds) function.

Notes

This is a Cython-accelerated implementation using dfg_number_t as the floating-point type.

Added in version 0.3.9.

Examples

>>> log_expit(0.5)
-0.4740769841801067