Fuzzy Logic? What the heck is that?

Betul Ince
6 min readAug 9, 2021

Do you know what “fuzzy” actually means? According to Cambridge Dictionary, it means “(of an image) having shapes that do not have clear edges, or (of a sound, especially from a television, radio, etc.) not clear, usually because of other unwanted noises making it difficult to hear”.

Not clear. Now, let’s think about this for a minute. Imagine you go to a modern art gallery with your friend and you are in a room full of helium balloons.

Andy Warhol — Silver Clouds, Wien

Here is possible sentences your friend might say:

“Balloons are filled with mixture of regular air and pure helium.”

“Balloons’ colors are silver.”

“There are 15 balloons in this room.”

Each can be considered true of false. Moreover, it is possible to prove their correctness or incorrectness. But what if your fried says:

“The artist’s purpose is very meaningful. This room is beautiful.”

Can you prove? Can we say that this is true or false? Artist can accept this as true, as it is his own art. But any visitor who has never liked the art will argue that this premise is false. From another point of view, art lovers who cannot fully understand the art will say that this is partially true. No matter how long the discussion drags on, it is certain that there will not be a definite decision as in the previous propositions among so many conflicts. The reason for this is the fact that the concept of “beauty” or “meaning” in the proposition is not an objective and measurable concept that doesn’t change from person to person. It’s relative. It’s not clear.

This is exactly what fuzzy logic deals with. It’s beyond right and wrong. Like you saw on the first picture. Boy on the left says “He is not tall” while the girl on the right says the opposite, “He is tall”. Their definition of a fact is based on their experience and perception. Our sense organs and our way of thinking are neither as sensitive as a thermometer nor as a ruler. It’s relative.

In traditional logic which we can also call Aristotelian logic, 1.0 represents absolute truth value while 0.0 represents absolute false value. But in fuzzy system, there is no such a logic for absolute truth and false value. There are intermediate values that are partially true and partially false.

Fuzzy Logic is a way of dealing with uncertainties. Which is something that computers don’t do naturally but human being’s do very well. You might classify something as true or false which is 1.0 or 0.0. It is very simple, there is only one option, nothing in between. But that is not the way that the real world works, that’s the way that humans work. So i can look outside from my window and say “Today is kind of a bit sunny with some dark clouds, it’s 0.4 nice weather”.

How it works?

With temperature, as you can see above, things don’t just suddenly go from cold to hot. So, for example between T2 and T3 we kinda mixing “cold” and “warm”. It’s neither strictly cold nor strictly warm.

When we are dealing with uncertainties we have got membership function with a range covering the interval (0,1) that allows us to model them. With fuzzification process you assign the numerical input of a system to fuzzy sets with some degree of membership. It represents the degree of truth. Any value between 0 and 1 represents the degree of uncertainty that the value belongs in the set(like i mentioned above “it’s 0.4 nice weather”). These fuzzy logic systems which use membership functions and have these degrees of truth are used very widely.

This diagram shows the fuzzy logic system. First we have some input which aren’t signed a truth value yet this means they are not in a fuzzy set. But then we modify them by looking at membership functions and sign some value to them between 0 and 1. Currently we have our fuzzy sets and it’s going to inference engine.

Now let’s take a break from how the system works, and give an example. Think about how washing machine works. When it will stop washing your clothes? Do you think it’s only about the numbers on the button or the temperature that you set before starting the machine?

Well… It’s not. It checks the load of the wash, how dirty the water is after some washing time and cycles, it decides how fast to spin etc.

Now let’s get back to the inference engine. We have fuzzy rules base here. For example:

IF water IS dirty THEN add_detergent OR do_another_rinse_cycle

Water is our fuzzy set, we are checking it against the dirty membership function. And for instance it’s still black we can say that membership function dirty is 1. So if dirty is 1, we need to act on it in some way, we can then spin fast or add more detergent etc.

Inference engine takes the rules and applies them on fuzzy sets and come up with an output, some decided action. This action is in the form of fuzzy sets. So we need to defuzzify them to make them understandable for computers because as you know computers can only understand 1 and 0, they deal with certainties.

Why Fuzzy Logic?

If we didn’t use fuzzy logic, we would do too many measurements and use too many if statements to get the same result:

temp = 20
dirt = 5
if temp < 25 and dirt > 6:
do add_detergent
...

And we would have to do this over and over again.

Lotfi Zadeh, who is creator of the concept of fuzzy logic, once said: “In almost every case you can build the same product without fuzzy logic, but fuzzy is faster and cheaper.”

It’s not clear.

In conclusion

Sometimes, solving some real-world problems with Aristo Logic or accessing all the numerical data which are necessary to get in the outcome is often inconvenient and costly. With fuzzy logic in these situations where we don’t have enough information; It can produce logical results even in uncertain situations by using human value judgements, thinking a decision making power..

Thank you for reading!

References

--

--

Betul Ince

Software Engineer @ Deloitte Cloud Engineering, known to shed a tear or two while debugging