# looking for a short explanation of fuzzy logic

I got the idea that basics of fuzzy logic is not that hard to grasp. And I got the feeling that someone might explain it to me in like 30 minutes. I understand neural networks and am able to re-create the famous Xor problem. And understand how to go just beyond it and create 3 layer networks of x nodes.

I'd like to understand fuzzy logic till a similar usefully level, in C# language. However the problem I face, is I first need to get the concept right however I see many websites who include lots of errors in their basic explaining of this. Like for example showing pictures and use different numbers as shown in pictures to calculate their problem, as if lots of people just copied stuff without noticing what they where actually writing down. While others for me go to deep in their math notation). To me that's very annoying to learn from.

For me there is no need to re-invent wheel; Aforge already got a fuzzy logic framework. So what I am looking for are some good examples, good examples like how the neural XOR problem is solved. Is there anyone such a instructional resource out there; do you know a web page, or YouTube where it is shortly explained, what would you recommend me?

Note this article comes close; but it just doesn't nail it for me. After that I downloaded a bunch of free PDF's but most are academic and hard to read for me (I'm not English and don't have a special academic math degree).

(I've been looking around a lot for this, good starter material about it is hard to find).

-
What is "the famous Xor problem," for those of us unfamiliar with it? – Mason Wheeler Nov 13 '12 at 23:26
Well if you are going to learn neural networks people start with AND OR and NOT gates, those are simple to understand and require only 2 layers of neural nodes. However to solve the XOR problem, a hidden layer of neural nodes is required and from there back-propagation is explained. A good starter you can find here : dev.mind.ilstu.edu/curriculum/artificial_neural_net/… at page 3 XOR is introduced; from there people realize that you can solve more chalanging problemse – user613326 Nov 13 '12 at 23:41
Fuzzy Logic n. def: Logical dictations that upon hearing may cause excessive hair growth. Related: Brian Kernighan, Paul Hudak – Jimmy Hoffa Nov 13 '12 at 23:48
Hint: fuzzy logic is not the same as woolly thinking :) – Simon B Dec 18 '14 at 16:26

Fuzzy logic is based on fuzzy set theory. In traditional set theory an element `s` either belongs or does not belong to a set `S`. In contrast, fuzzy set theory allows partial membership: an element `s` can belong to a fuzzy set `F` to some degree. More formally a fuzzy set is defined by its membership function, which assigns a degree of membership to its elements.

Fuzzy sets are useful for describing everyday concepts, such as "short people" vs. "tall people". A person, whose height is 175 cm could be a member of the fuzzy set `ShortPeople` with a degree of 0.7 and, at the same time, a member of the fuzzy set `TallPeople` with a degree of 0.4. In other words, you can be both tall and short at the same time with different degrees of membership. The membership values are often between 0 and 1, but they don't have to be. Unlike probabilities they do not have to add up to 1, and unlike probability density functions, the membership functions do not have to integrate to 1.

The membership function of the set `ShortPeople` could be a triangle centered around 150 cm, and the membership function of the set `TallPeople` could be centered around 185cm. You might also define sets for `ReallyShortPeople` and `Giants`.

Union and intersection can be defined on fuzzy sets (typically as max and min of the membership values, respectively). Thus fuzzy `and` and `or` can also be defined.

What you are talking about is fuzzy rule-based systems, that approximate some unknown function that is hard to define explicitly. In your car example the input might be how hard you press on the accelerator, and the output might the the speed of the car. You define fuzzy sets that represent how hard you press on the gas (`slightly`, `medium`, `hard`), and fuzzy sets that represent the speed of the car (`slow`, `medium`, `fast`). Then you define fuzzy rules mapping the press of the pedal to speed: `slightly` -> `slow',`medium`->`medium`,`hard`->`fast`. This is your fuzzy rule-based system.

The system works in three stages: fuzzification, inference, and de-fuzzification. First you take a "crisp" input (the exact amount of pressure applied to the pedal), and calculate its membership in the corresponding fuzzy sets. Then you get the corresponding fuzzy value of the car speed (inference). Finally, you need to "crispify" or "defuzzify" that value to get the actual car speed.

-
Hmm, if i had to control a car with fuzzy logic. Like i have to drive 50km/h a little bit below or above isnt bad, but to fast gives me a ticket. obviously i could drive a static speed of 50 km/h. however sooner or later i would bump someone. So i add bumper and speed sensors. From the triangle math (as in wikipedia fuzy control system). I dont get it, would my car by fuzzy rules find an optimal solution, or are fuzzy logic answers not optimal; is it just self regulation to keep it inside limits ? or am i missing the point here what is the benefit of fuzzy logic in my car? – user613326 Nov 14 '12 at 1:38
I think in practice fuzzy control systems operate under the condition of not applying continual smooth corrections, but rather depending on range or particular fuzzy value offer different rates of adjustment. The farther from optimal, the larger the corresponding adjustment. Instead of making a bunch of small moves or adjustments, rather a much less frequent adjustment is needed to reach an optimal state. – JustinC Nov 14 '12 at 4:42
@JustinC So for example if f(x) = y fuzzy set; would fuzzy be something like x=(n*x + y-x) / n + 1 In there y-x would correct x while n a static number would be a function slow the responsivnes to smooth it out a bit. – user613326 Nov 14 '12 at 14:19
Fuzzy logic is much easier to derive from expert human experience. You can precisely measure the inputs and outputs of a system, but if you don't know the exact equations that link them, it doesn't help you to design a control unit for that system. Fuzzy logic gets around that by implementing rules-of-thumb. "If the tempreature is too hot, turn the gas down a bit". – Simon B Dec 18 '14 at 16:22

If you are knowledgeable about neural networks, then you already know fuzzy logic. Fuzzy logic is a general, high level term for any imprecise logic - anything where predictions must be made based on a number of parameters.

Contrast this with more 'concrete' logic.

Neural networks are an implementation of fuzzy logic.

-
Hm yes well partly, the fuzzy part i am confused is about those triangle graph's. like in this wiki page: en.wikipedia.org/wiki/Fuzzy_control_system With like: low / middle / high input where the boundaries can overlap. This to me is very different from neural networks. And seams to me more like defining wanted behaviour, instead training behaviour like in a neural net. Which seams to me a bit strange. – user613326 Nov 14 '12 at 1:12
Fuzzy logic uses a model, like the model you would train with a neural network. A fuzzy logic model may or may not be trained; it could also be built according to other research or analysis, or manual measurements - it doesn't matter. The triangles are just a way of displaying variances and expected values. – Kirk Broadhurst Nov 14 '12 at 1:20
are they more like model descriptions that till some degree can solve ?; i was thinking of them like they provide solutions as neural networks can learn and try to solve something. Was i wrong here? – user613326 Nov 14 '12 at 1:42