Most inventions start with someone making a big mistake and then someone yelling *Eureka!*. Fuzzy logic is exactly this, but with a twist…

Imagine yourself in a rowboat with a passenger. You are faced backwards and rowing, the passenger is giving hints how to arrive on the destination. *Littlebit to the left, somewhat more, continue straight, a bit to the right. Allmost there, slowdown and… done.*

This is how we organized our lives for years. *Watch out! The coffee is hot.* And *we need to get some groceries, we’re allmost out of milk and eggs.* Nowhere is there an exact number. When rowing a boat it would become very strange if someone said *5 degrees to the left, continue for 348 meters and slow down with 0.4 meter/second*.

This all changed with maths and computers. Computers don’t understand these vague terms like ‘somewhat left’, especially because these vague terms are context sensitive. The “hot” in “*Hot* Coffee” means something different than the “hot” in “*Hot* Volcano” or “*Hot* Girl”. Computers have changed our lives and we, as humans, have learned to adapt to this exact world.

We now know that a coffee between 65°C and 75°C is warm and 76°C and higher is hot, don’t we? The problem with this is that if temperature between 65 and 75 means warm and temperature > 75 is hot… why does it suddenly change from hot to warm when the temperature drops from 75.1° to 75.0°. It just doesn’t makes sense to us humans. I know we could introduce another definition “very warm”, but still… it us adapting to an exact world while we use vague terms.

And here we introduce our friend Lofti Zadeh who could say *Eureka*! Zadeh was a mathematician who also struggled with these terms and came up with the concept of *Fuzzy Sets. *These fuzzy sets can be used to calculate with vague terms like *Hot Coffee* but also with *Hot Volcano*.

We can agree that 75°C and higher is *Hot* for a cup of cofee. But 74° stil is somewhat hot but also a littlebit warm. When we are at 73° it is somewhat less hot and somewhat more warm. When it becomes 71° it is more warm than hot and 70° really is warm. The line is somewhat *fuzzy*.

We can define a slope for the hot, for example from 70° to 75°. Above is really hot. In this case we can say that 71° is 20% hot, 72° is 40% all the way up to 100% for 75°. This is called the fuzzy membership, 71° is for 20% member of the group *Hot. *In Fuzzy we don’t use percentages but a value between 0 and 1 where 0 = False (0%) and 1 = True (100%). We should therefore say that 71° is 0.2 member of Hot, 72° is 0.4 member all the way up to 1.0 for 75°. Now it is easy to calculate the memberships in between. 70.5° is for example 0.1 member of hot and 0.9 member of warm.

The advantage with the 0..1 value is that we also can use standard math. The NOT function is 1-{fuzzy value}, AND function is MIN({value1},{value2}) and OR is MAX({value1},{value2}).

We can use for example the temperature 71°. This is 0.8 *warm* and 0.2 *hot*.

NOT hot is then 1 – 0.2 = 0.8, *hot* AND *warm* is MIN(0.2, 0.8) = 0.2, *hot* OR *warm* is MAX(0.2, 0.8) = 0.8

This fuzzy scale is just for hot-drinks like tea and coffee and will probably not work for a volcano. But, for a volcano we can make just as easy a scale for a warm and hot volcano. This is the context sensitivity we talked about.

These basic concepts will be used in future blogposts, so subscribe if you want to know more about these concepts in datawarehousing, dataanalysis and marketing!

do you have othere reference?