Sigmoidal¶
The Sigmoidal Membership Function implements a smooth S-shaped curve that transitions gradually from 0 to 1. It is widely used in fuzzy logic systems and neural networks for modeling smooth transitions and gradual changes.
The Sigmoidal Membership Function is defined by the logistic function:
$$\mu(x) = \frac{1}{1 + e^{-a(x - c)}}$$
The function is characterized by two parameters:
a: Slope parameter - controls the steepness of the S-curve
- Positive values: standard sigmoid (0 → 1 as x increases)
- Negative values: inverted sigmoid (1 → 0 as x increases)
- Larger |a|: steeper transition (more abrupt change)
- Smaller |a|: gentler transition (more gradual change)
c: Center parameter - controls the inflection point where μ(c) = 0.5
- μ(c) = 0.5 (50% membership)
- Shifts the curve left/right along the x-axis
a ≠ 0: Cannot be zero (would result in constant function μ(x) = 0.5)
a and c can be any real numbers otherwise
Partial Derivatives¶
For optimization in ANFIS networks, we need the gradients of the membership function with respect to each parameter. The sigmoid function has elegant derivative properties:
Derivative of the Sigmoid Function
For μ(x) = 1/(1 + e^{-a(x-c)}), the derivative with respect to x is:$$\frac{d\mu}{dx} = \mu(x) \cdot (1 - \mu(x)) \cdot a$$
This is a fundamental property of the sigmoid function and is used extensively in neural networks.
Partial Derivatives w.r.t. Parameters
For μ(x) = 1/(1 + exp(-a(x-c))):
- ∂μ/∂a = μ(x) · (1 - μ(x)) · (x - c)
- ∂μ/∂c = -a · μ(x) · (1 - μ(x))
Python Example¶
Let's create a sigmoidal membership function and visualize it:
import numpy as np
import matplotlib.pyplot as plt
from anfis_toolbox.membership import SigmoidalMF
sigmoid = SigmoidalMF(a=2, c=0)
x = np.linspace(-5, 5, 200)
y = sigmoid(x)
plt.plot(x, y)
plt.show()
Visualization¶
The following interactive plot shows different sigmoidal membership functions with varying parameter combinations. Each subplot demonstrates how the slope (a) and center (c) parameters affect the shape of the S-curve.