I am new to fuzzy logic with python and have been implementing the skfuzzy library. The first example that I have looked at is the tipping problem, here -> https://pythonhosted.org/scikit-fuzzy/auto_examples/plot_tipping_problem_newapi.html
I implemented my own version of it, but i have found out that the output (tip) never goes past a certain threshold. For example, even if the meal was 10/10 and the service was 10/10, it would never give a tip of a full 25% and vice versa. The lowest is 4.33% and 21%. Why is that?
This is a problem because I am using it to implement a washing machine. It seems ridiculous that the output never goes past the last quarter of the "average" , and that no input will ever be able to hit the boundaries of the output. Can somebody lead me to why that is so?
Here is my jupyter notebook because someone requested - its not very different from the tipping problem, but here it is.
import numpy as np
import skfuzzy as fuzz
from skfuzzy import control as ctrl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# New Antecedent/Consequent objects hold universe variables and membership
# functions
numdish = ctrl.Antecedent(np.arange(0, 51, 1), 'number of dishes')
dirtiness = ctrl.Antecedent(np.arange(0, 101, 1), 'level of dirtiness')
washtime = ctrl.Consequent(np.arange(0, 61, 1), 'wash time')
##numdish.automf(3)
numdish['low'] = fuzz.trimf(numdish.universe, [0,0,25])
numdish['average'] = fuzz.trimf(numdish.universe, [0, 25, 50])
numdish['high'] = fuzz.trimf(numdish.universe, [25, 50, 50])
##dirtiness.automf(3)
dirtiness['light'] = fuzz.trimf(dirtiness.universe, [0, 0, 40])
dirtiness['medium'] = fuzz.trimf(dirtiness.universe, [15, 50, 85])
dirtiness['heavy'] = fuzz.trimf(dirtiness.universe, [60, 100, 100])
washtime['short'] = fuzz.trimf(washtime.universe, [0, 0,25])
washtime['average'] = fuzz.trapmf(washtime.universe, [0, 25,35, 60])
washtime['long'] = fuzz.trimf(washtime.universe, [35,60,60])
##If numdish is low OR dirtiness is light, washtime will be short
rule1 = ctrl.Rule(numdish['low'] | dirtiness['light'], washtime['short'])
##If numdish is high AND dirtiness is heavy, washtime will be long
rule2 = ctrl.Rule(numdish['high'] & dirtiness['heavy'], washtime['long'])
##If numdish is high OR dirtiness is heavy, washtime will be long
rule3 = ctrl.Rule(numdish['high'] | dirtiness['heavy'], washtime['long'])
##If numdish is low AND dirtiness is light, washtime will be short
rule4 = ctrl.Rule(numdish['low'] & dirtiness['light'], washtime['short'])
##If numdish is average AND dirtiness is medium, washtime will be average
rule5 = ctrl.Rule(numdish['average'] & dirtiness['medium'], washtime['average'])
washtime_ctrl = ctrl.ControlSystem([rule1, rule2, rule3, rule4, rule5])
washtiming = ctrl.ControlSystemSimulation(washtime_ctrl)
# Here, you can pass in inputs to test the system.
washtiming.input['number of dishes'] = 5
washtiming.input['level of dirtiness'] = 15
# Crunch the numbers
washtiming.compute()
print(washtiming.output['wash time'])
washtime.view(sim=washtiming)
Even when the values are set to 0,0 the lowest wash time is still 8 minutes. Even when the values are set to 50,100 the highest wash time is still 51 minutes.
Why does it stop at those boundaries? Shouldn't an input of 0 number of dishes and 0 level of dirtiness give 0 and vice versa?
I hope the question is clear now.