Gaussian Combination¶
The Gaussian combination membership function (Gaussian2MF) is a versatile fuzzy membership function that combines two Gaussian curves with an optional flat region in between. This function is particularly useful for representing fuzzy sets with asymmetric shapes or plateau regions, making it suitable for applications where the membership degree needs to be constant over a range of values.
The function is characterized by four main parameters:
- sigma1 ($\sigma_1$): Standard deviation of the left Gaussian tail (must be positive).
- c1 ($c_1$): Center of the left Gaussian tail.
- sigma2 ($\sigma_2$): Standard deviation of the right Gaussian tail (must be positive).
- c2 ($c_2$): Center of the right Gaussian tail. Must satisfy $c_1 \leq c_2$.
The mathematical formula for the Gaussian combination membership function is defined piecewise:
$$\mu(x) = \begin{array}{ll} e^{-\frac{(x-c_1)^2}{2\sigma_1^2}} & x < c_1 \\[6pt] 1 & c_1 \leq x \leq c_2 \\[6pt] e^{-\frac{(x-c_2)^2}{2\sigma_2^2}} & x > c_2 \end{array}$$
where:
- $\mu(x)$ is the degree of membership of element $x$ in the fuzzy set.
- $x$ is the input value.
- $\sigma_1, c_1$ define the left Gaussian tail.
- $\sigma_2, c_2$ define the right Gaussian tail.
When $c_1 = c_2$, the function becomes an asymmetric Gaussian centered at $c_1$ with different spreads on each side.
Partial Derivatives¶
The partial derivatives of the Gaussian combination membership function are essential for optimization in adaptive fuzzy systems. Since the function is piecewise, derivatives are computed separately for each region.
Derivative with respect to $c_1$
For $x < c_1$: $$\frac{\partial \mu}{\partial c_1} = \frac{x-c_1}{\sigma_1^2} e^{-\frac{(x-c_1)^2}{2\sigma_1^2}}$$
For $c_1 \leq x \leq c_2$: The derivative is 0 (flat region).
For $x > c_2$: The derivative is 0.
Derivative with respect to $\sigma_1$
For $x < c_1$: $$\frac{\partial \mu}{\partial \sigma_1} = \frac{(x-c_1)^2}{\sigma_1^3} e^{-\frac{(x-c_1)^2}{2\sigma_1^2}}$$
For other regions: The derivative is 0.
Derivative with respect to $c_2$
For $x < c_1$: The derivative is 0.
For $c_1 \leq x \leq c_2$: The derivative is 0.
For $x > c_2$: $$\frac{\partial \mu}{\partial c_2} = \frac{x-c_2}{\sigma_2^2} e^{-\frac{(x-c_2)^2}{2\sigma_2^2}}$$
Derivative with respect to $\sigma_2$
For $x > c_2$: $$\frac{\partial \mu}{\partial \sigma_2} = \frac{(x-c_2)^2}{\sigma_2^3} e^{-\frac{(x-c_2)^2}{2\sigma_2^2}}$$
For other regions: The derivative is 0.
These derivatives enable gradient-based optimization of the membership function parameters.
Python Example¶
import matplotlib.pyplot as plt
import numpy as np
from anfis_toolbox.membership import Gaussian2MF
gaussian2 = Gaussian2MF(sigma1=.5, c1=2, sigma2=1, c2=5)
x = np.linspace(0, 10, 100)
y = gaussian2(x)
plt.plot(x, y)
plt.show()
Visualization¶
Below is a comprehensive visualization showing how the Gaussian2MF shape changes with different parameter combinations. We'll explore variations in the centers (c₁, c₂) and standard deviations (σ₁, σ₂).
The visualization above demonstrates various configurations of the Gaussian2MF. This flexibility makes Gaussian2MF suitable for modeling complex fuzzy concepts with asymmetric uncertainty or plateau regions where membership should remain constant.