sklvq.activations.Sigmoid

class sklvq.activations.Sigmoid(beta: float = 1)[source]

Sigmoid function

Class that holds the sigmoid function and gradient as discussed in [1]

Parameters:
betaint or float, optional, default=1

Positive non-zero value that controls the steepness of the Sigmoid function.

See also

Identity, SoftPlus, Swish

References

[1] Villmann, T., Ravichandran, J., Villmann, A., Nebel, D., & Kaden, M. (2019). “Activation Functions for Generalized Learning Vector Quantization - A Performance Comparison”, 2019.

__call__(x: ndarray) ndarray[source]
Computes the sigmoid function:

f(\mathbf{x}) = \frac{1}{e^{-\beta \cdot \mathbf{x}} + 1}

Parameters:
xndarray of any shape.
Returns:
ndarray of shape (x.shape)

Elementwise evaluation of the sigmoid function.

gradient(x: ndarray) ndarray[source]
Computes the sigmoid function’s gradient with respect to x:

\frac{\partial f}{\partial \mathbf{x}} = \frac{(\beta \cdot e^{\beta \cdot \mathbf{x})}}{(e^{\beta \cdot \mathbf{x}} + 1)^2}

Parameters:
xndarray of any shape
Returns:
ndarray of shape (x.shape)

Elementwise evaluation of the sigmoid function’s gradient.