# What is the meaning of triangles color in the result of Tipping Problem in scikit-fuzzy (fuzzy logic)?

I am following this example https://scikit-fuzzy.github.io/scikit-fuzzy/auto_examples/plot_tipping_problem_newapi.html from documentation of scikit-fuzzy library,but I have a question in the figure why the triangle of both low and high is colored when the result is for example is 14.5%? Is that righ? the low and high is colored? Isn't it more correct low and medium is colored? sorry but I miss understanding the mean of coloring the result... any help

here the code:

• Where did you find this example (please include a link)? It would be better to include your code as text so that others can quickly reproduce your calculations. Depending on the rules that were set up for this fuzzy calculation, there is no issue with having membership in the high and low categories simultaneously. Oct 20 at 19:47
• This question is more related to an specific library or software, which might find a better solution if OP asks it in their Q&A forum or open an issue in their Github repo. Oct 21 at 12:56
• thanks, I just mentioned the link Oct 22 at 7:48
• Just to go full circle, the question was posted as an issue on the scikit-fuzzy Github page and the package author closed the issue, redirecting to my answer on this post. Nov 10 at 15:48

## Rule Evaluation

It may help to see their explanation of the rules for translating from service/quality to a tip.

1. If the food is poor OR the service is poor, then the tip will be low
2. If the service is average, then the tip will be medium
3. If the food is good OR the service is good, then the tip will be high.

You changed the quality to 3, which has roughly .4 membership in the "poor food" category. The first rule says you should turn the higher of the "poor food" membership and the "poor service" membership into "low tip" membership. scikit-fuzzy defaults to "fuzzifying" the OR operator by taking the Max of the corresponding memberships. Since the service was a perfect 10 (0.0 membership in "poor service"), the "low tip" membership is 0.4.

Since service was 10, it has 0.0 membership in the average category as well, so the "medium tip" has 0.0 membership. Finally, the service being a 10 gives a "good service" membership of 1.0, which translates to a "good tip" membership of 1.0.

As I described in a prior post here, the tip is then evaluated by calculating the expectation value of the tip over the shaded area.

## Changing the Rules

If you want the medium tip category to also have membership, you need to change the rules you are using. Its not well documented on your linked page, but the code for rules specifies that multiple values can be passed in to consequent, allowing you to change rule 1 to:

rule1=ctrl.Rule=(quality["poor"] | service["poor"],(tip["low"],tip["medium"])

This is just one of many different types of rules you can specify for this problem, depending on how much you want to value/weight quality and service in terms of deciding a tip.

• Tyberius thank you very much for your clear explanation, I posted the question on another site, but no response.... Thanks again Nov 11 at 19:22
• No problem. If you found the answer useful, consider accepting it (little checkmark on the left side of the post) and giving it an upvote. Nov 11 at 19:30