sigmoid#

scikitplot.experimental._logsumexp.sigmoid(x, axis=None)[source]#

Compute the sigmoid function for the input array x.

The sigmoid function is defined as:

sigmoid(x) = 1 / (1 + exp(-x))
\[\text{sigmoid}(x) = \frac{1}{1 + e^{-x}}\]

Added in version 0.3.9.

Parameters:
xarray-like

Input array for which to compute the sigmoid. This can be a list, numpy array, or any array-like structure.

axisint or None, optional

Axis or axes along which to compute the sigmoid. If None, the sigmoid will be computed over the entire array. The default is None.

Returns:
numpy.ndarray

The sigmoid of each element in x, with the same shape as x.

Examples

>>> import numpy as np
>>> from scikitplot.experimental._logsumexp import sigmoid
>>> x = np.array([0, 1, 2])
>>> sigmoid(x)
array([0.5       , 0.7310586 , 0.88079708])