5 Fuzzy Expert System
5 Fuzzy Expert System
LAB (3)
Fuzzy Expert System
April, 2021
Page |2
Objectives
To be able to build fuzzy expert system using Python.
Introduction
Fuzzy Logic is a methodology predicated on the idea that the “truthiness” of something
can be expressed over a continuum. This is to say that something isn’t true or false but
instead partially true or partially false.
A fuzzy variable also has several terms that are used to describe the variable. The terms
taken together are the fuzzy set which can be used to describe the “fuzzy value” of a
fuzzy variable. These terms are usually adjectives like “poor,” “mediocre,” and “good.”
Each term has a membership function that defines how a crisp value maps to the term
on a scale of 0 to 1. In essence, it describes “how good” something is.
So, back to the tip example, a “good tip” might have a membership function which has
non-zero values between 15% and 25%, with 25% being a “completely good tip” (ie, it’s
membership is 1.0) and 15% being a “barely good tip” (ie, its membership is 0.1).
Page |3
A fuzzy control system links fuzzy variables using a set of rules. These rules are simply
mappings that describe how one or more fuzzy variables relates to another. These are
expressed in terms of an IF-THEN statement; the IF part is called the antecedent and the
THEN part is the consequent. In the tipping example, one rule might be “IF the service
was good THEN the tip will be good.”
The Tipping Problem: Creating a fuzzy control system which models how you might
choose to tip at a restaurant. When tipping, you consider the service and food quality, rated
between 0 and 10. You use this to leave a tip of between 0 and 25%.
Problem formula:
Antecedents (Inputs)
1. Service:
Universe: How good was the service of the wait staff, on a scale of 0
to 10?
Fuzzy set: poor, acceptable, amazing
2. Food Quality:
Consequents (Outputs)
1. Tip
1. If the service was good or the food quality was good, then the tip will be
high.
2. If the service was average, then the tip will be medium.
3. If the service was poor and the food quality was poor then the tip will be
low.
Page |5
Good Luck :)