What is Fuzzy Logic in AI and What are its Applications? Fuzzy Logic in Python.
In our day to day life, we might face situations where we are unable to determine whether the state is true or false. Fuzzy refers to something unclear or vague. Fuzzy Logic in AI provides valuable flexibility for reasoning.
What is Fuzzy Logic?
Fuzzy Logic (FL) is a method of reasoning that resembles human reasoning. This approach is similar to how humans perform decision making. And it involves all intermediate possibilities between YES and NO.
The conventional logic block that a computer understands takes precise input and produces a definite output as TRUE or FALSE, which is equivalent to a human being’s YES or NO. The Fuzzy logic was invented by Lotfi Zadeh who observed that unlike computers, humans have a different range of possibilities between YES and NO, such as:
The Fuzzy logic works on the levels of possibilities of input to achieve a definite output. Now, talking about the implementation of this logic:
- It can be implemented in systems with different sizes and capabilities such as micro-controllers, large networked, or workstation-based systems.
- Also, it can be implemented in hardware, software, or a combination of both.
Why do we use Fuzzy Logic?
Generally, we use the fuzzy logic system for both commercial and practical purposes such as:
- It controls machines and consumer products
- If not accurate reasoning, it at least provides acceptable reasoning
- This helps in dealing with the uncertainty in engineering
So, now that you know about Fuzzy logic in AI and why do we use it, let’s move on and understand the architecture of this logic.
Fuzzy Logic Architecture
The fuzzy logic architecture consists of four main parts:
- Rules — It contains all the rules and the if-then conditions offered by the experts to control the decision-making system. The recent update in the fuzzy theory provides different effective methods for the design and tuning of fuzzy controllers. Usually, these developments reduce the number of fuzzy rules.
- Fuzzification — This step converts inputs or the crisp numbers into fuzzy sets. You can measure the crisp inputs by sensors and pass them into the control system for further processing. It splits the input signal into five steps such as-
- Inference Engine — It determines the degree of match between fuzzy input and the rules. According to the input field, it will decide the rules that are to be fired. Combining the fired rules, form the control actions.
- Defuzzification — The Defuzzification process converts the fuzzy sets into a crisp value. There are different types of techniques available, and you need to select the best-suited one with an expert system.
So, this was about the architecture of fuzzy logic in AI. Now, let’s understand the membership function.
The membership function is a graph that defines how each point in the input space is mapped to a membership value between 0 and 1. It allows you to quantify linguistic terms and represent a fuzzy set graphically. A membership function for a fuzzy set A on the universe of discourse X is defined as μA:X → [0,1]
It quantifies the degree of membership of the element in X to the fuzzy set A.
- the x-axis represents the universe of discourse.
- the y-axis represents the degrees of membership in the [0, 1] interval.
There can be multiple membership functions applicable to fuzzify a numerical value. Simple membership functions are used as the complex functions do not add precision to the output. The membership functions for LP, MP, S, MN, and LN are:
The triangular membership function shapes are most common among various other membership function shapes. Here, the input to the 5-level fuzzifier varies from -10 volts to +10 volts. Hence the corresponding output also changes.
Fuzzy Logic vs Probability
Fuzzy LogicProbabilityIn fuzzy logic, we try to capture the essential concept of vagueness. Probability is associated with events and not facts, and those events will either occur or not occurFuzzy Logic captures the meaning of partial truth probability theory captures partial knowledgeFuzzy logic takes truth degrees as a mathematical basic probability is a mathematical model of ignorance
So, these were some of the differences between fuzzy logic in AI and probability. Now, let’s have a look at some of the applications of this logic.
Applications of Fuzzy Logic
The Fuzzy logic is used in various fields such as automotive systems, domestic goods, environment control, etc. Some of the common applications are:
- It is used in the aerospace field for altitude control of spacecraft and satellite.
- This controls the speed and traffic in the automotive systems.
- It is used for decision making support systems and personal evaluation in the large company business.
- It also controls the pH, drying, chemical distillation process in the chemical industry.
- Fuzzy logic is used in Natural language processing and various intensive applications in Artificial Intelligence.
- It is extensively used in modern control systems such as expert systems.
- Fuzzy Logic mimics how a person would make decisions, only much faster. Thus, you can use it with Neural Networks.
Python Code for Fuzzy Logic is uploaded here