Classical logic insists that every statement is true or false. But human concepts are vague: "tall", "hot", "fast", "high risk". Is a 29°C day hot? Somewhat. Fuzzy logic, introduced by Lotfi Zadeh in 1965, formalises such graded concepts. It became famous through control systems — from washing machines and rice cookers to the Sendai subway in Japan, whose fuzzy controller gave a smoother ride.
Fuzzy sets#
A classical (crisp) set $A$ has a characteristic function $\chi_A(x) \in \{0, 1\}$. A fuzzy set has a membership function
where $\mu_A(x)$ is the degree to which $x$ belongs to $A$. Common shapes are triangular, trapezoidal and Gaussian:
Fuzzy operators#
Zadeh's standard operators generalise logic:
| Operation | Definition |
|---|---|
| AND (intersection) | $\mu_{A \cap B}(x) = \min(\mu_A(x), \mu_B(x))$ |
| OR (union) | $\mu_{A \cup B}(x) = \max(\mu_A(x), \mu_B(x))$ |
| NOT (complement) | $\mu_{\neg A}(x) = 1 - \mu_A(x)$ |
More generally, AND can be any t-norm (e.g. product $ab$) and OR any t-conorm (e.g. probabilistic sum $a + b - ab$). Note that fuzzy logic violates the law of excluded middle: $\max(\mu, 1 - \mu)$ can be less than 1.
A fuzzy controller, step by step#
Let us design a fan-speed controller. Input: temperature (°C). Output: fan speed (%).
Linguistic variables:
- Temperature: Cold, Warm, Hot.
- Fan speed: Slow, Medium, Fast.
Rules:
- IF temperature is Cold THEN speed is Slow.
- IF temperature is Warm THEN speed is Medium.
- IF temperature is Hot THEN speed is Fast.
The Mamdani inference process has four stages:
- Fuzzification — compute membership degrees of the crisp input.
- Rule evaluation — compute each rule's firing strength and clip its output set.
- Aggregation — combine clipped output sets with max.
- Defuzzification — convert the aggregated fuzzy set into a crisp number, usually with the centroid:
import numpy as np
def tri(x, a, b, c):
return np.maximum(0, np.minimum((x - a) / (b - a + 1e-9), (c - x) / (c - b + 1e-9)))
temp_sets = {"cold": (0, 10, 22), "warm": (18, 25, 32), "hot": (28, 38, 50)}
speed = np.linspace(0, 100, 501)
speed_sets = {"slow": tri(speed, 0, 15, 45), "medium": tri(speed, 30, 50, 70), "fast": tri(speed, 55, 85, 100)}
rules = [("cold", "slow"), ("warm", "medium"), ("hot", "fast")]
def fan_speed(t):
agg = np.zeros_like(speed)
for tin, sout in rules:
strength = tri(np.array(t, float), *temp_sets[tin]) # fuzzification
agg = np.maximum(agg, np.minimum(strength, speed_sets[sout])) # clip + aggregate
return float((speed * agg).sum() / (agg.sum() + 1e-9)) # centroid
for t in [8, 20, 26, 30, 40]:
print(t, "°C ->", round(fan_speed(t), 1), "%")Notice how the output changes smoothly with temperature — there is no abrupt jump at a threshold. That smoothness is exactly why fuzzy controllers feel natural.
Sugeno models#
The Takagi–Sugeno–Kang (TSK) model uses crisp functions as rule outputs, e.g. "IF temperature is Hot THEN speed $= 2t + 10$". The final output is the weighted average of rule outputs by firing strength. TSK models are computationally cheaper and easier to optimise.
Neuro-fuzzy systems#
ANFIS (Adaptive Neuro-Fuzzy Inference System, 1993) represents a Sugeno fuzzy system as a network and learns membership-function parameters by gradient descent. This combines the interpretability of linguistic rules with the adaptivity of learning — an early instance of the neuro-symbolic idea.
Where fuzzy logic stands today#
Fuzzy control remains common in consumer appliances, automotive subsystems, industrial process control and decision-support tools where experts can describe behaviour in words. In mainstream machine learning, probabilistic and neural methods dominate, but fuzzy ideas persist in soft membership (e.g. fuzzy c-means clustering) and in interpretable rule-based models.