Fuzzy output

150 views
Skip to first unread message

Sascha Williams

unread,
Nov 10, 2017, 4:41:40 AM11/10/17
to scikit-fuzzy
Dear Mr Warner,

thank you for the new release, which appears to work well with np arrays! Very nice work! :)

However, while playing around with the new scikit-fuzzy I stumbled over another question, which I am trying to describe using your tipping problem example (https://pythonhosted.org/scikit-fuzzy/auto_examples/plot_tipping_problem.html):

How is it possible with the given setup that the maximum tipping amount of 25% is triggered? Shouldn't the fuzzy system return this value when service AND quality have a value of 10? In my test, a maximum tip amount of 21% is reached, while the minimum is 4.333...

It might be that I this question is to blame to my beginners' understanding of fuzzy logic, but maybe you can help me sorting this out?

Thanks a lot and best wishes! 

Josh Warner

unread,
Nov 17, 2017, 11:16:14 PM11/17/17
to Sascha Williams, scikit-fuzzy

​S​
orry for the delay, rush before the holidays. This behavior is unintuitive but actually working as intended. Here is what is happening:

When the maximum values for service and quality are input, the terms service[‘good’] and quality[‘good’] are fully active at 100%. The Rule then combines them with AND, which is a minimum composition — that has no effect because they are identical. This 100% value is then passed to the Consequent term tip[‘good’], which is not cropped.

The crucial point happens here. The Consequent term, which is a triangular membership function that has significant membership area below the maximum in the output universe, is defuzzified by the centroid method. The centroid of this will never be the maximum value.

If you have the tipping problem set up, you can confirm this by the following after defining the tip Consequent:

term = tip['high']
fuzz.defuzz(term.parent.universe, term.mf, 'centroid')  # Result is 21.0

So, the actual responsive range is less than the span of the universe. While expected from the math, this is not necessarily intuitive.

Reply all
Reply to author
Forward
0 new messages