Fuzzy sets are put to use in systems that reason with rules written in everyday words, and in controllers for machines.
Fuzzy Rules and Fuzzy Expert Systems
A fuzzy rule has the form IF temperature is Hot AND humidity is High THEN fan speed is Fast, in which the conditions and the conclusion are fuzzy sets. A fuzzy expert system has a base of such rules, and an inference engine that works with degrees of truth, so it can handle vague and uncertain knowledge in a natural way. The rules are easy for experts to write, since they use the words that they themselves use.
Fuzzy Inference System
A fuzzy inference system (FIS) turns crisp inputs into a crisp output through four steps. Fuzzification converts each crisp input, such as 28 degrees, into degrees of membership in its fuzzy sets, such as Warm 0.7 and Hot 0.2. Rule evaluation finds how strongly each rule applies, using minimum for AND and maximum for OR. Aggregation combines the outputs of all the rules into one fuzzy set. Defuzzification converts this set to one crisp value. The common method is the centroid, which takes the centre of gravity of the area. Other methods are the mean of maximum and the weighted average. The two main types are Mamdani, in which the output is a fuzzy set, and Sugeno, in which the output is a function or a number, which is faster.
Definition: Fuzzy inference system. A system that maps crisp inputs to a crisp output through fuzzification, evaluation of fuzzy rules, aggregation of their results and defuzzification.
Fuzzy Controller
A fuzzy controller is a control system that uses fuzzy rules instead of mathematical equations. It has a sensor that reads the inputs, a fuzzifier, a rule base, an inference engine, a defuzzifier, and an actuator that carries out the output. It works well when the system is hard to model, is non-linear, or when expert knowledge is in words. Applications include washing machines, which set the wash time by the dirt and the load, air conditioners, cameras with auto-focus, anti-lock brakes, subway trains and rice cookers.
Table 4.5: Steps of a fuzzy inference system
| Step | Action | Example |
|---|---|---|
| Fuzzification | Crisp input to degrees | 28 C is Warm 0.7 |
| Rule evaluation | Find strength of rules | min of conditions |
| Aggregation | Combine rule outputs | max of outputs |
| Defuzzification | Fuzzy set to crisp value | Centroid |
Example 4.5: A small fuzzy decision
Problem: Rule 1: IF temperature is Warm THEN fan is Medium. Rule 2: IF temperature is Hot THEN fan is Fast. For a temperature, Warm = 0.7 and Hot = 0.2. Fan speed is Medium = 50 and Fast = 90. Use the weighted average to find the fan speed.
Solution:
- Strength of rule 1 is 0.7, and of rule 2 is 0.2.
- Weighted average = (0.7 × 50 + 0.2 × 90) / (0.7 + 0.2) = (35 + 18) / 0.9 = 58.9.
Result: The fan speed is about 59, between Medium and Fast but nearer Medium.
w = [0.7, 0.2]
v = [50, 90]
print(round(sum(a * b for a, b in zip(w, v)) / sum(w), 1))
Output
58.9
Common mistakes
- Skipping defuzzification, so that the system gives a fuzzy set instead of an action.
- Writing too few rules, so that some inputs have no rule that fires.
- Using fuzzy logic where an exact model is easy to write.
Key takeaways
- A fuzzy rule is IF condition is fuzzy set THEN output is fuzzy set.
- A FIS has fuzzification, rule evaluation, aggregation and defuzzification.
- The centroid method is a common defuzzification method.
- Fuzzy controllers are used in washing machines, cameras and brakes.
Practice questions
- Name the steps of a fuzzy inference system.
- What is defuzzification?
- Give two applications of a fuzzy controller.
Answers to the practice questions
- Fuzzification, rule evaluation, aggregation and defuzzification.
- Converting a fuzzy output set to a single crisp value.
- Washing machines and anti-lock brakes (also air conditioners, cameras).
Sources
- Official BCA syllabus Artificial Intelligence and Expert Systems, course code 25BCA405DS02, Unit IV
