模糊理論 -- 邏輯與模糊邏輯 email: chlee@mail.nhu.edu.tw 1
一些問題 電腦主要功能 四則及邏輯計算 如何讓電腦表示不精確及模糊的概念和事實 IF 天氣熱 and 陽光大 THEN 灑些水 IF 大盤漲 and 買量大 THEN 買進小量股票 冷熱 高矮 長短 漲跌 多少 大小...
知識的階層 Meta Knowledge Knowledge If gold is less than 500 and the price is rising (+) Then buy gold Information Data Noise GOLD 438+ 717976683252515643 137179766832525156430015 J. Giarratano and G. Riley, Expert Systems, PWS Publishing, 1998
傳統邏輯的知識表達 表達知識的方法 Information 有尾巴 ( 多多 ) 自然語言 邏輯表示 多多是條狗 所有的狗都有尾巴 狗 ( 多多 ) x 狗 (x)-> 有尾巴 (x) Knowledge
Logic and Sets 電腦中最基本的知識表示方法 Logic Syllogism 4th century B.C. by Aristotle Two premises One conclusion example Premise: Premise: All men are mortal Socrates is a man Conclusion: Socrates is mortal
Logic and Sets (cont.) Logic study of the rules of exact reasoning for the inference engine to reason from facts to conclusions automated reasoning systems
Logic and Sets (cont.) Premise: Premise: Conclusion: 如果 AI 課的老師是猴子, 則 AI 課的老師是哺乳動物 AI 課的老師是哺乳動物 AI 課的老師是猴子 Premise: Premise: Conclusion: 所有中國明代的帝王是男人 有些男人曾到過月亮 有些中國明代的帝王曾到過月亮
Logic and Sets (cont.) Sets Premise: Premise: Conclusion: All men are mortal Socrates is a man Socrates is mortal Socrates Man Mortal Creature
Propositional Logic Formal logic concerned with the syntax of statements rather than their semantics Premise: Premise: Conclusion: All squeegs are moofs John is a squeeg John is a moof nonsense words
Propositional Logic (cont.) By separating the form from the semantics, the validity of an argument can be considered objectively, without prejudice caused by the semantics. Premise: Premise: All X are Y Z is a X Conclusion: Z is a Y z X Y
An Expert System (Knowledge Based System) Knowledge Base (Rules) If X then Y If A then B Agenda If B and C then D If D or E then F and G If M and N then Z and X Explanation Facility Because B and C then D Inference engine Why D ABB User interface A Working Memory (Facts) F,G D Knowledge Acquisition Facility C B A Tell me more
在專家系統中的推理方式 Rule 1: IF Y is true AND D is true THEN Z is true Rule 2: IF X is true AND B is true AND E is true THEN Yis true Rule 3: IF A is true THEN X is true A X B E Y D Z
真實生活中的不確定性 Information in real application Incomplete Inconsistent Uncertain Uncertainty the lack of the exact knowledge that would enable us to reach a perfectly reliable conclusion. Classical logic ( 無法表示天氣冷這種模糊不精確概念 ) law of the excluded middle ( 二分法 ) IF A is true IF A is false THEN A is not false THEN A is not true True False
模糊的知識 如果人們的年收入超過 180 萬則他們是高收入老李的年收入是 181 萬 老李是高收入 True 老張的年收入是 179.99 萬 老張是高收入 False
模糊的知識 如果室溫超過 30 度則是高溫室溫是 31 度 室溫是高溫 室溫是 29.9 度 室溫是高溫 True False 如何讓電腦處理有些熱, 熱, 冷, 有些冷, 好冷或有些胖, 瘦, 等等的模糊詞句 如果路是滑的 則開車速度要放慢
模糊與不確定性 如果路可能是滑的 則開車速度快出車禍的機會很高 滑的, 快 -> 模糊詞句 可能 -> 不確定詞句 機會很高 -> 不確定又模糊
模糊的知識 1 歸屬函數 1 歸屬函數 0 180 收入 0 60 180 收入 有錢人 高收入 一般的邏輯 模糊的邏輯
歸屬函數 歸屬函數 A(x) 1 0.5 0 120K 150K 180K A: 模糊集合高收入 150K -> 高收入的歸屬度 = 0.5 收入 x
模糊的知識表達 歸屬函數 1 低收入 普通收入 高收入 0 60 120 180 收入
模糊理論的基本概念 模糊字詞 歸屬函數 1 低收入 普通收入 高收入 模糊集合 0 60 120 180 收入 模糊歸屬度的分佈 模糊規則 如果上班的人領的是高薪則他是有錢人
模糊規則 如果 x 是 A 前題 則 y 是 B 結果 如果路是滑的 如果番茄是紅的 如果速度是快的 則開車是危險的 則它是成熟的 則煞車是稍微的踩
模糊推理 模糊化模糊推理引擎解模糊化 數據輸入 模糊規則庫 數據輸出 倒單擺的應用
模糊智慧型自動化洗衣機 洗衣量 衣物柔軟度 自動化選擇行程 洗衣行程 洗衣時間 洗衣量 : 少量 small, 中量 medium, 大量 large 衣物柔軟度 : 軟 soft, 普通軟 normal soft, 普通硬 normal hard, 硬 hard 洗衣行程 : 微洗 delicate, 輕洗 light, 普通 normal, 強力洗淨 strong
設計柔軟度的歸屬函數 1 Hard Normal hard Normal soft Soft Laundry softness 柔軟度
設計洗衣量的歸屬度函數 1 Small Medium Large Laundry quantity 洗衣量
設計洗衣行程的歸屬度函數 1 Delicate Light Normal strong Washing cycle 洗衣行程
洗衣行程的模糊規則庫 Laundry quantity Laundry Small Medium Large softness Soft Delicate Light Normal Normal soft Light Normal Normal Normal hard Light Normal Strong Hard Light Normal Strong R5: IF Laundry quantity is Large AND Laundry softness is Hard THEN Washing Cycle is strong R6: IF Laundry quantity is Normal AND Laundry softness is Normal Hard THEN Washing Cycle is Normal
模糊推理 模糊化模糊推理引擎解模糊化 數據輸入 模糊規則庫 數據輸出
Fuzzy matching 模糊比對 1 Small Medium Large 0.5 0.2 Degree of match =0.5 Degree of match =0.2 Ri Rj 量測到的衣物高度 Height=40cm Laundry quantity
Fuzzy matching 1 0.5 Degree of match=0.2 0.2 IF 1 Small IF Medium Input Laundry quantity Laundry quantity 1 0.2 1 0.3 Normal soft Laundry softness Laundry softness Input Min (AND) Soft Then Min (AND) Degree of match=0.2 Then
方式一 1 Degree of Match=0.8 如何得到結論 Inference Clipping method 1 方式二 1 Degree of Match=0.8 Fuzzy consequent y Scaling method Inferred conclusion 1 y Fuzzy consequent y Inferred conclusion y
Combining Fuzzy conclusions Clipping method Scaling method
解模糊化 Defuzzification 1.Center of gravity defuzzifier Continuous Discrete 2.Mean of maxima defuzzifier Defuzzified output 3.Modified mean of maxima defuzzifier 4.Center average defuzzifier