anthonykulis / ai_tip_calculator

an extremely overpower tip calculator for the truly nerdy
GNU General Public License v3.0
0 stars 0 forks source link

build class perform fuzzy inference #2

Open anthonykulis opened 8 years ago

anthonykulis commented 8 years ago

this is kind of easy (assuming i haven't made any mistakes). if we have n defuzzified values we should be able to reference some rules to combine into the output set. then using the math found in this tutorial, find a crisp value of the output. this would be our tip percentage.

anthonykulis commented 8 years ago

notes:

imagine we have our rules: food was great and service was great then tip is great food was great or server was good this tip is ok food was ok and service was bad then tip is bad

in the and cases, we take the crisp value of the max, eg food has crisp value of .9 and service has crisp value of .8, then in case of food was great and service was great, we would use the .9 as in input to the output function

if it also meets food was great or server was good then the lower value would be used. in this case, .8 for the input of the second rule.

finally, we count all the output fuzzy sets that have a value >0 and then simply average them up. if that average comes to .95, we will use that output crisp average to then multiply against the maximum tip a customer is willing to pay (eg .3 * .95 = 28.5% tip).

anthonykulis commented 8 years ago

notes for russ, crisp fuzzy outputs are always between 0 and 1