![Page 1: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/1.jpg)
FUZZY LOGIC
KANOKWATT SHIANGJENCOMPUTER SCIENCE
SCHOOL OF INFORMATION AND COMMUNICATION TECHNOLOGY
UNIVERSITY OF PHAYAO
![Page 2: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/2.jpg)
Contents
• What is fuzzy logic?
• Application for fuzzy logic
• Why fuzzy logic?
• Fuzzy logic architecture
• Pros and Cons of fuzzy logic
• Q & A
• Reference
2
Source: https://www.techleer.com/articles/243-insight-into-the-concept-of-fuzzy-logic-in-artificial-intelligence/
![Page 3: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/3.jpg)
What is fuzzy logic?
3
• Fuzzy logic (FL) คอื วธิกีารออกแบบใหค้อมพวิเตอรส์ามารถใชเ้หตผุลที่
คลา้ยคลงึกบัวธิกีารใหเ้หตผุลของมนุษย ์ส าหรบัประกอบการตดัสนิใจทีไ่ม่ใช ่YES กบั NO
• ปกตคิอมพวิเตอรจ์ะสง่กลบัค าตอบทีเ่ป็น TRUE กบั FALSE และมนุษยก็์มกัจะมคี าตอบทีช่ดัเจน คอื YES กบั NO แตก็่มบี่อยคร ัง้ที่ ค าตอบทีไ่ดจ้ากมนุษยอ์าจไม่ใช ่YES กบั NO แตอ่าจแสดงในรปูของคา่ระดบั เชน่ น้อย ปานกลาง มาก เราเรียกว่า “Linguistic value” เป็นตน้ หากเรามองกลบัไปทีค่อมพวิเตอร ์โดยทัว่ไปนอกจากการสง่คา่กลบัออกมาเป็น TRUE กบั FALSE ก็สามารถสง่คา่ออกมาเป็นตวัเลข เชน่ จ านวนเต็ม จ านวนจรงิ เป็นตน้ ดงัน้ันเราสามารถทีจ่ะน าความรูต้รงนีไ้ปใชต้อ่ไป
![Page 4: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/4.jpg)
What is fuzzy logic?
4
Traditional Logic:
True False
1 0
Fuzzy Logic:
True False
0.8 0.2
“If service is good, even if the food is not excellent, the tip will be generous”
Source: http://www.dma.fi.upm.es/recursos/aplicaciones/logica_borrosa/web/fuzzy_inferencia/motivb_en.htm
“If service is good, then tip is average”
“If service is poor or food is bad, then tip is cheap”
![Page 5: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/5.jpg)
What is fuzzy logic?
5
“If service is good, even if the food is not excellent, the tip will be generous”
Source: https://www.mathworks.com/help/fuzzy/input-output_map.png
“If service is good, then tip is average”
“If service is poor or food is bad, then tip is cheap”
![Page 6: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/6.jpg)
What is fuzzy logic?
6Source: http://slideplayer.com/slide/3902376/13/images/5/Cold+water+%E2%80%93+Taps+and+Valves.jpg
Traditional Logic: Fuzzy Logic:
hot cold hot cold???
Source: http://mazsola.iit.uni-miskolc.hu/DATA/diploma/brutoczki_kornelia/013.gif
Binary membership function Multi-level membership function
“Fuzzy Logic is a common sense”
![Page 7: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/7.jpg)
Application for fuzzy logic
7
• เคร ือ่งปรบัอากาศ / อปุกรณค์วบคมุความชืน้
• ตูเ้ย็น
• หมอ้หงุขา้ว
• เคร ือ่งซกัผา้
• ระบบเกยีรอ์ตัโนมตัิ
Source: https://www.canstarblue.com.au/wp-content/uploads/2016/10/Split-system-air-conditioner.jpgSource: https://tigerthailand.bentoweb.com/th/product/235703/product-235703
Source: https://www.lg.com/th/refrigerator/lg-GC-X247CSAV
Source: https://www.topvalue.com/130005814-electrolux-ewf12942.html
![Page 8: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/8.jpg)
Air conditioner
8Source: https://www.canstarblue.com.au/wp-content/uploads/2016/10/Split-system-air-conditioner.jpg
Target
Temperature
Room
Temperature
Command
No Change
Heat
Cool
![Page 9: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/9.jpg)
Automatic brake system
9Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
far close
Traditional Logic:
![Page 10: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/10.jpg)
Automatic brake system
10Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
far close
Traditional Logic:
Is the car close? (0 or 1) No or Yes
Brake? (0 or 1) Off or On
![Page 11: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/11.jpg)
Automatic brake system
11Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
far close
Is the car close? (0) No
Brake? (0) Off
Traditional Logic:
![Page 12: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/12.jpg)
Automatic brake system
12Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
close
Traditional Logic:
Is the car close? (1) Yes
Brake? (1) On
![Page 13: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/13.jpg)
Automatic brake system
13Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
far close
Fuzzy Logic:
Is the car close? (0 - 1) Range of No to Yes
Brake? (0 - 1) Range of Off to On
![Page 14: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/14.jpg)
Automatic brake system
14Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
far close
Fuzzy Logic:
Is the car close? (0.3) Not very close
Brake? (0.3) Slight pressure
![Page 15: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/15.jpg)
Automatic brake system
15Source: https://thetomatos.com/wp-content/uploads/2016/05/vw-bug-clipart-1.jpg
Source: http://clipart-library.com/images/kcKo6Eyxi.png
far close
Fuzzy Logic:
Is the car close? (0.7) Pretty close
Brake? (0.7) Fairly Heavy Pressure
![Page 16: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/16.jpg)
Example
16Source: http://www.logicaldesigns.com/Ldfuz1.gif
Source: https://upload.wikimedia.org/wikipedia/commons/4/47/Fuzzy_control_-_input_and_output_variables_mapped_into_a_fuzzy_set.png
![Page 17: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/17.jpg)
Why fuzzy logic?
17
• Fuzzy logic ใชจ้ดัการกบัความไม่แน่นอน (Uncertainty)
• สามารถพจิารณาระดบัของความเป็นจรงิ (Degree of truth)
• สามารถพจิารณาสว่นหน่ึงของสมาชกิทีอ่ยูใ่นเซต (Partial membership)
• แลว้เราจะบอกใหค้อมพวิเตอรร์ูไ้ดอ้ยา่งไรวา่อนันี ้อ้วน เรว็ หล่อ สวย ในเมือ่
คา่ระดบัความ อ้วน เรว็ หล่อ สวย ของแตล่ะคนน้ันอาจไม่เทา่กนั
![Page 18: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/18.jpg)
What is the standard?
• น า้หนักของชาวยโุรป vs เอเชยี
• ความสงูของชาวยโุรป vs เอเชยี
• อายุ ความสงูและน า้หนักตวัทีเ่หมาะสม?
18
Body Mass Index: BMI
![Page 19: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/19.jpg)
Fuzzy set (Zadeh, 1965)
• เป็นทฤษฏเีซต ทีม่นิียามดงัตอ่ไปนี้
• การเป็นสมาชกิของเซตใดๆ จะถกูก าหนดใหเ้ป็นคา่ระดบัความเป็นสมาชกิ (Degree of membership) ระหวา่ง 0 – 1
• ถา้ระดบัความเป็นสมาชกิเท่ากบั 1 แสดงวา่เป็นสมาชิกอย่างแน่นอน• ถา้ระดบัความเป็นสมาชกิเท่ากบั 0 แสดงวา่ไมไ่ด้เป็นสมาชิก
19
![Page 20: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/20.jpg)
Membership function
• การนิยามคา่ระดบัความเป็นสมาชกิ จะขึน้อยูก่บันิยามของผูอ้อกแบบฟังกช์นัสมาชกิ (Membership function)
• ฟังกช์นัสมาชกิของ fuzzy set A บน universe of discourse X is defined as A: X -> [0, 1]
• โดยแตล่ะสมาชกิของ X จะมกีาร mapped กบัคา่ทีอ่ยูร่ะหวา่ง 0 – 1 เรยีกวา่ Degree of membership
20
![Page 21: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/21.jpg)
Membership function
โดยทัว่ไป Membership function จะแสดงอยู่ในรปูของสมการทางคณิตศาสตร ์ซ ึง่เรามกัจะแสดงผลในรปูของกราฟ 2 มติ ิเพือ่ใหส้ามารถท าความเขา้ใจไดง้่าย
• แกน x แทน universe of discourse (ขอบเขตทีเ่ราสนใจ เชน่ น้อย ปานกลาง มาก เป็นตน้)
• แกน y แทน degree of membership between 0 and 1 (ระดบัความเป็นสมาชกิ)
21
![Page 22: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/22.jpg)
Membership function
• รปูแบบกราฟิกทีไ่ดร้บัความนิยมคอื(a) Singleton
(b) Triangular
(c) Trapezoidal
(d) Gaussian
22Source: https://www.codeproject.com/KB/library/Fuzzy-Framework/image009.jpg
(a) (b)
(c) (d)
![Page 23: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/23.jpg)
Singleton
23
0, x a
A(x) = 1, x = a
a
![Page 24: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/24.jpg)
Triangular
24
a m b
0.2
0.4
0.6
0.8
1.0
![Page 25: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/25.jpg)
Trapezoidal
25
0.2
0.4
0.6
0.8
1.0
a b c d
![Page 26: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/26.jpg)
R-Trapezoidal
26
0.2
0.4
0.6
0.8
1.0
c d
![Page 27: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/27.jpg)
L-Trapezoidal
27
0.2
0.4
0.6
0.8
1.0
a b
![Page 28: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/28.jpg)
Gaussian
28
0.2
0.4
0.6
0.8
1.0
m
k : standard deviation (k > 0)
![Page 29: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/29.jpg)
Example: Membership function
29Source: http://www.logicaldesigns.com/Ldfuz1.gif
Source: https://upload.wikimedia.org/wikipedia/commons/4/47/Fuzzy_control_-_input_and_output_variables_mapped_into_a_fuzzy_set.png
(1) เราตอ้งสรา้งสมการของ Membership function
(2) เราตอ้งทราบความเรว็ (x)
(3) แทนความเรว็ (x) ใน (1) เพือ่หาจดุตดั
(4) คา่จดุตดัใชแ้ทนระดบัของความเป็นสมาชกิเพือ่ใช ้
ใน Inference engine ตอ่ไป
![Page 30: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/30.jpg)
Example: Membership function
30Source: http://www.logicaldesigns.com/Ldfuz1.gif
Source: https://upload.wikimedia.org/wikipedia/commons/4/47/Fuzzy_control_-_input_and_output_variables_mapped_into_a_fuzzy_set.png
ก าหนดให ้Universe of Speed >= 0
(1) slow(x) = ?, medium(x) = ?, fast(x) = ?
(2) x = 50
(3) slow(50) = 0.33, medium(50) = 0.67, fast(50) = 0
(4) เราจะไดค้า่ระดบัความเป็นสมาชกิเพือ่ใชใ้น
Inference engine ตอ่ไป
50
0.33
0.67
![Page 31: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/31.jpg)
Non-Fuzzy
• The Tipping Problem (Non-Fuzzy)
31
Service Charge = 15% Service between = 5-25%
Depend on quality of service
From (0 – 10)
Service between = 5-25%
Depend on quality of service
from (0 – 10) and
quality of food
![Page 32: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/32.jpg)
Fuzzy
• The Tipping Problem (Fuzzy)
32
Service Food Tip (%)
Cheap Average GenerousPoor Good Excellent
0.5
1.0
0
Standard Deviation = 1.5
![Page 33: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/33.jpg)
The Tipping Problem
• Tipping Problem ประกอบดว้ย 3 Factors คอื• Service
• Food
• Tip
• Rules:• If the service is poor or the food is rancid, then the tip is cheap
• If the service is good, then the tip is average
• If the service is excellent or the food is delicious, then the tip is generous
33
เราจะสามารถรวมผลลพัธจ์าก กฎทุกขอ้เพือ่ตอบค าถามไดอ้ย่างไร?
![Page 34: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/34.jpg)
The Tipping Problem
34
Input 1Service (0-10)
Input 2Food (0-10)
Rule 1:If service is poor or food is rancidThen tip is cheap
Rule 2:If service is goodThen tip is average
Rule 3:If service is excellent or food is deliciousThen tip is generous
Output
Tip (5-25%)
The Input are crisp
(non-fuzzy) numbers
limit to specify range
(fuzzification)
All rules are evaluated in parallel
using fuzzy reasoning
The results of the rules
are combined
and distilled (defuzzification)
The result is
a crisp (non-fuzzy)
number
![Page 35: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/35.jpg)
Fuzzy Operators
• Union: AB(x) = (A (x) OR B (x))
= MAX(A (x), B (x))
• Intersection: AB(x) = (A (x) AND B (x))
= MIN(A (x), B (x))
• Complement: Ac(x) = 1 - A (x)
35
“Fuzzy Operators จะถกูน าไปใชใ้นขัน้ตอนของ Inference engine”
![Page 36: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/36.jpg)
Fuzzy Operators: AND
A B A AND B
T T T
T F F
F T F
F F F
36
A B A AND B
1 1 1
1 0 0
0 1 0
0 0 0
A B MIN(A ,B)
1 1 1
1 0 0
0 1 0
0 0 0
A B MIN(A, B)
T T T
T F F
F T F
F F F
ก าหนดให ้T = 1, F = 0
![Page 37: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/37.jpg)
Fuzzy Operators: OR
A B A OR B
T T T
T F T
F T T
F F F
37
A B A OR B
1 1 1
1 0 1
0 1 1
0 0 0
A B MAX(A ,B)
1 1 1
1 0 1
0 1 1
0 0 0
A B MAX(A, B)
T T T
T F T
F T T
F F F
ก าหนดให ้T = 1, F = 0
![Page 38: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/38.jpg)
Fuzzy Operators: Complement
A NOT A
T F
F T
38
ก าหนดให ้T = 1, F = 0
A COMPLEMENT A = (1 – A)
T F
F T
A NOT A
1 0
0 1
A COMPLEMENT A = (1 – A)
1 0
0 1
![Page 39: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/39.jpg)
Crisp set• ส าหรบั crisp set A ทีม่สีมาชกิใน Universe X,
• x A : x เป็นสมาชกิทีอ่ยู่ใน A
• x A : x ไม่เป็นสมาชกิทีอ่ยู่ใน A
• x X : x เป็นสมาชกิทีอ่ยู่ใน Universe X
• ตวัอยา่งก าหนดให ้Universe X = ความเรว็ตัง้แต ่0 – 200• Crisp set A = {25, 50, 75, 120}
• 25 A, 50 A, 75 A, 120 A, 180 A
• 25 X, 50 X, 75 X, 120 X, 180 X
39
![Page 40: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/40.jpg)
Fuzzy logic architecture
40
Fuzzifier
Knowledge-based
DefuzzifierInference
engine
Crisp
input
Fuzzy
input
set
Fuzzy
output
set
Crisp
output
Membership
function
![Page 41: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/41.jpg)
Fuzzy logic architecture
สถาปัตยกรรมของ Fuzzy logic ประกอบดว้ย 4 สว่นทีส่ าคญั คอื
• Fuzzification: แปลง Crisp input ใหก้ลายเป็น Fuzzy input
• Knowledge-based: ฐานความรูข้องกฎ (Rules) ทีม่าจากผูเ้ช ีย่วชาญ อยู่ในรปูของ IF-THEN
• Inference engine: ตรวจสอบ Fuzzy input กบั Rules ทีอ่ยูใ่น Knowledge-based แลว้แปลงใหอ้ยูใ่นรปูของ Fuzzy output
• Defuzzification: แปลง Fuzzy output ใหก้ลายเป็น Crisp output
41
![Page 42: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/42.jpg)
How to develop a fuzzy logic system?
42
• Define the linguistic variables and terms (ความสงู นอ้ย ปานกลาง มาก)
• Construct the membership functions for them (น าเสนอไดใ้นรปูแบบกราฟิก)
• Construct the knowledge base of the rules (กฎในการตดัสนิใจ if-then)
• Convert crisp data into fuzzy datasets using the membership functions(Fuzzification)
• Evaluate rules in the rule base. (Inference engine using if)
• Combine results from each rule (Inference engine using then)
• Convert output data into non-fuzzy values (Defuzzification แปลงค าตอบในรปู linguistic variable ใหเ้ป็นตวัเลขทีเ่ป็นค าตอบ)
![Page 43: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/43.jpg)
Classification of fuzzy inference methods
Fuzzy reasoning
Direct methods
Mamdani’s direct method
Takagi and Sugeno ‘s method
Simplified method
Indirect method
43
![Page 44: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/44.jpg)
Mamdani’s Method
44
Evaluate antecedent
Obtain conclusion
Aggregate conclusions
Defuzzification
Summary
![Page 45: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/45.jpg)
Customer review: Service = 3, Food = 8
• The Tipping Problem (Fuzzy)
45
Service Food Tip (%)
Cheap Average GenerousPoor Good Excellent
0.5
1.0
0
Standard Deviation = 1.5
0.1354
0.4111
Service = Poor (0.1354)
Service = Good (0.4111)
Food = Good (0.4)
Food = Delicious (0.75)
Tip = ???
![Page 46: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/46.jpg)
Inference Rules
• If the service is poor or the food is rancid, then the tip is cheap
• If the service is good, then the tip is average
• If the service is excellent or the food is delicious, then the tip is generous
• Fuzzy input ทีอ่ยูห่ลงั If เราจะเรยีกวา่ Antecedent
• Fuzzy output ทีอ่ยูห่ลงั then เราจะเรยีกวา่ Consequent
46
Antecedent Consequent
![Page 47: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/47.jpg)
Evaluate antecedent
47
0.750.75
![Page 48: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/48.jpg)
Obtain conclusion
48
![Page 49: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/49.jpg)
Aggregate conclusions
49
0.1354
0.4111
0.7500
![Page 50: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/50.jpg)
Defuzzification
50
0.1354
0.4111
0.7500
![Page 51: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/51.jpg)
Defuzzification
51
0.1354
0.4111
0.7500
![Page 52: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/52.jpg)
Types of Defuzzification
• Centroid method (Center of gravity)
• Max-membership principle (Height method)
• Weighted average method
• Mean-max membership (Middle of Maxima)
• Center of sums
• Center of Largest area
• Etc.
52
![Page 53: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/53.jpg)
Weighted Average Method
• เป็นวธิกีารทีเ่หมาะกบัผลลพัธข์องฟังกช์นัสมาชกิทีม่คีวามสมมาตร(Symmetrical) และมผีลลพัธใ์กลเ้คยีงกบั Centroid method
• วธิกีารนีส้ามารถค านวณคา่ผลลพัธไ์ดอ้ยา่งรวดเรว็ โดยใชค้า่น า้หนักจาก maximum membership value มาใชใ้นการค านวณ
53
𝑧∗ =σ𝜇 ҧ𝑥 ∙ ҧ𝑥
σ𝜇 ҧ𝑥ҧ𝑥 คอื คา่น ้าหนักจาก average membership value
![Page 54: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/54.jpg)
Weighted Average Method
54
𝑧∗ =σ𝜇 ҧ𝑥 ∙ ҧ𝑥
σ𝜇 ҧ𝑥
𝑧∗ =0.1354 × 5 + 0.4111 × 12.5 + 0.75 × 20
0.1354 + 0.4111 + 0.75𝑧∗ = 16.04
𝑤ℎ𝑒𝑟𝑒 ҧ𝑥 is average membership value
0.1354
0.4111
0.7500
5 12.5 20
![Page 55: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/55.jpg)
Pros and Cons of fuzzy logic
• Pros• ความรูท้ีไ่ดม้าจากผูเ้ช ีย่วชาญ
• เหมาะกบัระบบทีจ่ดัการกบัปัญหาทีไ่ม่ตอ้งการความถกูตอ้ง 100%
• สรา้ง และท าความเขา้ใจไดง่้าย
• ประยกุตใ์ชง้านไดห้ลากหลาย เชน่ปรมิาณยา ตอ่น ้าหนักตวัของผูป่้วยเป็นตน้
• Cons• ไม่เหมาะกบัระบบทีจ่ดัการกบัปัญหาที่
ตอ้งการความถกูตอ้ง 100%
• ท าความเขา้ใจไดย้าก ถา้ปัญหามคีวามซบัซอ้น
55
![Page 56: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/56.jpg)
Q & A
56
![Page 57: FUZZY LOGIC · fuzzy logic kanokwatt shiangjen computer science school of information and communication technology university of phayao](https://reader034.vdocument.in/reader034/viewer/2022050402/5f7fbccaaa05ac7fbc785fbd/html5/thumbnails/57.jpg)
Reference• https://www.tutorialspoint.com/artificial_intelligence/artificial_intelligence_fuzzy_logic_systems.htm
• https://www.youtube.com/watch?v=rln_kZbYaWc
• https://en.wikipedia.org/wiki/Fuzzy_logic
• http://www.cs.su.ac.th/~tasanawa/cs517561/is6.pdf
• http://www.dma.fi.upm.es/recursos/aplicaciones/logica_borrosa/web/fuzzy_inferencia/funpert_en.htm
• https://www.ibu.edu.ba/assets/userfiles/it/2012/eee-Fuzzy-1.ppt
• http://mike.watts.net.nz/Teaching/IIS/Lecture5.pdf
• https://www.youtube.com/watch?v=O348HnWPm7A
• https://www.youtube.com/watch?v=wBrHEXkTero
• https://www.youtube.com/watch?v=LupUhRJo_sU&t=167s
57