I'm new to A.I. and I'd like to know in simple words, what is the fuzzy logic concept? How does it help, and when is it used?
As complexity rises, precise statements lose meaning and meaningful statements lose precision. ( Lofti Zadeh ).
Fuzzy logic deals with reasoning that is approximate rather than fixed and exact. This may make the reasoning more meaningful for a human:
Fuzzy logic is an extension of Boolean logic by Lotfi Zadeh in 1965 based on the mathematical theory of fuzzy sets, which is a generalization of the classical set theory. By introducing the notion of degree in the verification of a condition, thus enabling a condition to be in a state other than true or false, fuzzy logic provides a very valuable flexibility for reasoning, which makes it possible to take into account inaccuracies and uncertainties.
One advantage of fuzzy logic in order to formalize human reasoning is that the rules are set in natural language. For example, here are some rules of conduct that a driver follows, assuming that he does not want to lose his driver’s licence:
Intuitively, it thus seems that the input variables like in this example are approximately appreciated by the brain, such as the degree of verification of a condition in fuzzy logic.
I've written a short introduction to fuzzy logic that goes into a bit more details but should be very accessible.
Fuzzy logic is based on regular boolean logic. Boolean logic means you are working with truth values of either true or false (or 1 or 0 if you prefer). Fuzzy logic is the same apart from you can have truth values that are in-between true and false, which is to say, you are working with any number between 0 (inclusive) and 1 (inclusive). The fact that you can have a 'partially true and partially false' truth value is where the word "fuzzy" comes from. Natural languages often use fuzzy logic like "that balloon is red" meaning that balloon could be any colour that is similar enough to red, or "the shower is warm". Here is a rough diagram for how "the temperature of the shower is warm" could be represented in terms of fuzzy logic (the y axis being the truth value and the x-axis being the temperature):
Fuzzy logic can be applied to boolean operations such as and, or, and not. Note that you can define the fuzzy logic operations in different ways. One way is with the min and max functions which return the lessermost and greatermost values of the two values inputted respectively. This would work as such:
A and B = min(A,B) A or B = max(A,B) not A = 1-A (where A and B are real values from 0 (inclusive) to 1 (inclusive))
When defined like this they are called the Zadeh operators.
Another way would be to define and as the first argument times the second argument, which yields different outputs for the same inputs as the Zadeh and operator (
min(0.5,0.5)=0.5, 0.5*0.5=0.25). Then other operators are derived based on the and and not operators. This would work as such:
A and B = A*B not A = 1-A A or B = not ((not A) and (not B)) = 1-((1-A)*(1-B)) = 1-(1-A)*(1-B) (where A and B are real values from 0 (inclusive) to 1 (inclusive))
You can then use the three "basic fuzzy logic operations" to build all other "fuzzy logic operations", just like you can use the three "basic boolean operations" to build all other "boolean logic operations".
Note that the latter definition of the three basic operations is more in line with probability theory, so could be considered the more natural choice.
Note: if anyone could suggest some more reliable sources in the comments, I will happily add them to the list (I understand that the current ones aren't too reliable).
It's analogous to analogue versus digital, or the many shades of gray in between black and white: when evaluating the truthiness of a result, in binary boolean it's either true or false (0 or 1), but when utilizing fuzzy logic, it's an estimated probability between 0 and 1 (such as 0.75 being mostly probably true). It's useful for making calculated decisions when all information needed isn't necessarily available.
Why is it useful?
Many things we don't know for sure. We estimate and are often uncertain, but nearly never 100% sure. It may seem like a weakness, but because of this fuzzy approach we can function in this complex world and even behave quite intelligently. Hence it's a way to simplify things. And it gives you some leeway to fill the gaps appropriately, e.g. to adapt to slightly varying situations. P.S.: In natural language we express this with quantitive terms like more, less, nearly, rather, immense and so on. But quantifying things is hard for us.
Fuzzy Logic is a way of dealing with uncertainties, which is something that computers don't do naturally which human do very well. The way we instantly think of dealing with things and the way that computers tend to deal with certain things is 'True' or 'False', or '1 or '0'. For example, you might classify someone is alive as alive ('True') or has passed away ('False'). We only have two options, there is no inbetween. With fuzzy logic, instead of going with 'True' or 'False', between that, we have what's called a degree of truth. So for example, when we look out the window, we might say "It's a bit cloudy today, maybe it's 0.5 'nice day' or 0.7 'nice day'". So essentially, with fuzzy logic we always have grey areas which vary from person-to-person.