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 which is unclear or vague. Fuzzy Logic in AI provides valuable flexibility for reasoning. And in this article, we will learn about this logic and its implementation in Artificial Intelligence in the following sequence:
- What is Fuzzy Logic?
- Why do we use Fuzzy Logic?
- Architecture
- Membership Function
- Fuzzy Logic vs Probability
- Applications of Fuzzy Logic
- Advantages & Disadvantages
- Fuzzy Logic in AI: Example
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 actually use it, let’s move on and understand the architecture of this logic.
Check out this Artificial Intelligence Course by Edureka to upgrade your AI skills to the next level.
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.
Using AI tools in software development can reduce developers’ coding skills, and sometimes code may be inaccurate or some error may occur. To overcome these disadvantages, Enroll in our Generative AI for Java developers course today!
Membership Function
The membership function is a graph that defines how each point in the input space is mapped to 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.
x-axis represents the universe of discourse.
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 in 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 5-level fuzzifier varies from -10 volts to +10 volts. Hence the corresponding output also changes.
Top 10 Trending Technologies to Learn in 2024 | Edureka
Fuzzy Logic vs Probability
Fuzzy Logic | Probability |
In fuzzy logic, we basically try to capture the essential concept of vagueness. | Probability is associated with events and not facts, and those events will either occur or not occur |
Fuzzy Logic captures the meaning of partial truth | Probability theory captures partial knowledge |
Fuzzy logic takes truth degrees as a mathematical basis | 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.
AI fuzzy logic may help in content recommendations and adjusting interface elements based on user experience. To know more enroll in our AI for Designers Course today! These were some of the common applications of the Fuzzy Logic. Now, let’s have a look at the advantages and disadvantages of using Fuzzy Logic in AI.
Advantages & Disadvantages of Fuzzy Logic
Fuzzy logic provides simple reasoning similar to human reasoning. There are more such advantages of using this logic, such as:
The structure of Fuzzy Logic Systems is easy and understandable
Fuzzy logic is widely used for commercial and practical purposes
It helps you to control machines and consumer products
It helps you to deal with the uncertainty in engineering
Mostly robust as no precise inputs required
If the feedback sensor stops working, you can program it into the situation
You can easily modify it to improve or alter system performance
Inexpensive sensors can be used which helps you to keep the overall system cost and complexity low
These were the different advantages of fuzzy logic. But, it has some disadvantages as well:
Fuzzy logic is not always accurate. So the results are perceived based on assumptions and may not be widely accepted
It cannot recognize machine learning as-well-as neural network type patterns
Validation and Verification of a fuzzy knowledge-based system needs extensive testing with hardware
Setting exact, fuzzy rules and, membership functions is a difficult task
At times, the fuzzy logic is confused with probability theory
So, these were some of the advantages and disadvantages of using fuzzy logic in AI. Now, let’s take a real-world example and understand the working of this logic.
Fuzzy Logic in AI: Example
The design of a fuzzy logic system starts with a set of membership functions for each input and a set for each output. A set of rules is then applied to the membership functions to yield a crisp output value. Let’s take an example of process control and understand fuzzy logic.
Step 1
Here, Temperature is the input and Fan Speed is the output. You have to create a set of membership functions for each input. A membership function is simply a graphical representation of the fuzzy variable sets. For this example, we will use three fuzzy sets, Cold, Warm and Hot. We will then create a membership function for each of three sets of temperature:
Step 2
In the next step, we will use three fuzzy sets for the output, Slow, Medium and Fast. A set of functions is created for each output set just as for the input sets.
Step 3
Now that we have our membership functions defined, we can create the rules that will define how the membership functions will be applied to the final system. We will create three rules for this system.
- If Hot then Fast
- If Warm then Medium
- And, if Cold then Slow
These rules apply to the membership functions to produce the crisp output value to drive the system. Thus, for an input value of 52 degrees, we intersect the membership functions. Here, we are applying two rules as the intersection occurs on both functions. You can extend the intersection points to the output functions to produce an intersecting point. You can then truncate the output functions at the height of the intersecting points.
This was a very simple explanation of how the fuzzy logic systems work. In a real working system, there would be many inputs and the possibility of several outputs. This would result in a fairly complex set of functions and many more rules.
With this, we have come to the end of our Fuzzy Logic in AI article. I hope you understood what is fuzzy logic and how it works.
Got a question for us? Please mention it in the comments section of “Fuzzy Logic in AI” and we will get back to you.