Professional Documents
Culture Documents
DSlab Exp 3 Rugved
DSlab Exp 3 Rugved
Rugved shinde
20101A0009
20101A0012 INFT
INFT VII VII
Data Science lab
Data Science Lab
Program No. 03
LP x is Large Positive
MP x is Medium Positive
S x is Small
MN x is Medium Negative
LN x is Large Negative
• Knowledge Base − It stores IF-THEN rules provided by
experts.
• Inference Engine − It simulates the human reasoning
process by making fuzzy inference on the inputs and IF-
THEN rules.
• Defuzzification Module − It transforms the fuzzy set
obtained by the inference engine into a crisp value.
Membership Function
Membership functions allow you to quantify linguistic term and
represent a fuzzy set graphically. A membership function for a
fuzzy set A on the universe of discourse X is defined as μA:X → [0,1].
Here, each element of X is mapped to a value between 0 and 1. It is
called membership value or degree of membership. It quantifies the
degree of membership of the element in X to the fuzzy set A.
Algorithm
• Define linguistic Variables and terms (start)
• Construct membership functions for them. (start)
• Construct knowledge base of rules (start)
• Convert crisp data into fuzzy data sets using membership
functions. (fuzzification)
• Evaluate rules in the rule base. (Inference Engine)
• Combine results from each rule. (Inference Engine)
• Convert output data into non-fuzzy values. (defuzzification)
Applications Automotive Systems
• Automatic Gearboxes
• Four-Wheel Steering
• Vehicle environment control
Consumer Electronic Goods
• Hi-Fi Systems
• Photocopiers
• Still and Video Cameras
• Television
For this particular experiment let us consider a restaurant tipping
system:
Let’s create 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%.
We would formulate this problem as:
• Antecednets (Inputs)
o service
▪ Universe (ie, crisp value range): How good was the
service of the wait staff, on a scale of 0 to 10?
▪ Fuzzy set (ie, fuzzy value range): poor, acceptable,
amazing
o food quality
▪ Universe: How tasty was the food, on a scale of 0 to
10?
▪ Fuzzy set: bad, decent, great
• Consequents (Outputs)
o tip
▪ Universe: How much should we tip, on a scale of 0%
to 25%
▪ Fuzzy set: low, medium, high
• Rules
o IF the service was good or the food quality was good,
THEN the tip will be high.
o IF the service was average, THEN the tip will be
medium.
o IF the service was poor and the food quality was poor
THEN the tip will be low.
• Usage
o If I tell this controller that I rated:
▪ the service as 9.8, and
▪ the quality as 6.5,
o it would recommend I leave:
▪ a 20.2% tip.
quality.automf(3)
quality['poor'].view()
service.automf(3)
service['average'].view()
rule1.view()
print( tipping.output['tip'])
tip.view(sim=tipping)
Execution Input:
tipping.input['quality'] = 6.5
tipping.input['service'] = 9.8
Output: