1
Teori Dasar
Crisp Logic
Crisp logic is concerned with absolutes-true or
false, there is no in-between.
Contoh:
Rule:
If the temperature is higher than 80F, it is hot; otherwise,
it is not hot.
Kasus:
Temperature = 100F Hot
Temperature = 80.1F Hot
Temperature = 79.9F Not hot
Temperature = 50F Not hot
2
Fungsi Keanggotaan untuk crisp logic
True
HOT
False
0
80F Temperature
Fuzzy values
DOM
Degree of
Membership
Young Middle Old
1
0.5
0
25 40 55 Age
4
Fuzzy vs Probabilitas
• Fuzzy Probabilitas
• - Probabilitas berkaitan dengan ketidakmenentuan
dan kemungkinan
- Logika Fuzzy berkaitan dengan ambiguitas dan
ketidakjelasan
• Contoh 1:
Billy memiliki 10 jari kaki. Probabilitas Billy memiliki 9 jari kaki
adalah 0. Keanggotaan Fuzzy Billy pada himpunan orang
dengan 9 jari kaki 0
• Contoh 2:
- Probabilitas botol 1 berisi air beracun adalah 0.5 dan 0.5
untuk isi air murni {mungkin air tersebut tidak beracun}
- Isi botol 2 memiliki nilai keanggotaan 0.5 pada himpunan air
berisi racun {air pasti beracun}
5
Fuzzyfication (1)
Sangat Sangat
pendek Pendek Sedang Tinggi tinggi
1.0
6
Fuzzyfication (2)
Sangat Sangat
pendek Pendek Sedang Tinggi tinggi
1.0
0.58
0.42
1.0 1.0
0 a b 0 a b
Domain Domain
8
Fungsi Keanggotaan: Segitiga
1.0
0 a b c
Segitiga
[x] = 0; x a atau x c
(x-a)/(b-a); a x b
(c-x)/(c-b); b x c
9
Fungsi Keanggotaan: Trapesium
1.0
0 a b c d
Trapesium
[x]= 0; x a atau x d
(x-a)/(b-a); a x b
1; b x c
(d-x)/(d-c); c x d
10
Fungsi Keanggotaan: Sigmoid
1.0
0 a b c
Sigmoid
[x;a,b,c]sigmoid = 0; x a
2 ((x - a)/(c - a))2; a x b
1 - 2((c - x)/(c - a))2; b x c
1; x c
11
Fungsi Keanggotaan: Phi
1.0
[x;a,b,c]phi = [x;c-b,c-b/2,c]sigmoid; x c
[x;c,c+b/2,c+b]sigmoid; x > c
12
Fuzzy Rules
In 1973, Lotfi Zadeh published his second most influential paper.
This paper outlined a new approach to analysis of complex systems,
in which Zadeh suggested capturing human knowledge in fuzzy
rules.
IF x is A
THEN y is B
Rule: 1 Rule: 2
IF speed is > 100 IF speed is < 40
THEN stopping_distance is long THEN stopping_distance is short
The variable speed can have any numerical value between 0 and
220 km/h, but the linguistic variable stopping_distance can take
either value long or short.
In other words, classical rules are expressed in the black-and-white
language of Boolean logic.
Rule: 1 Rule: 2
IF speed is fast IF speed is slow
THEN stopping_distance is long THEN stopping_distance is short
In fuzzy rules, the linguistic variable speed also has the range (the
universe of discourse) between 0 and 220 km/h, but this range
includes fuzzy sets, such as slow, medium and fast.
The universe of discourse of the linguistic variable
stopping_distance can be between 0 and 300 m and may include
such fuzzy sets as short, medium and long.
16
Model Fuzzy Mamdani
Contoh: persoalan sederhana dengan 2 input (x dan y),1
output (z) dan 3 rules
Rule: 1 Rule: 1
IF x is A3 IF project_funding is adequate
OR y is B1 OR project_staffing is small
THEN z is C1 THEN risk is low
Rule: 2 Rule: 2
IF x is A2 IF project_funding is marginal
AND y is B2 AND project_staffing is large
THEN z is C2 THEN risk is normal
Rule: 3 Rule: 3
IF x is A1 IF project_funding is inadequate
THEN z is C3 THEN risk is high
17
Step 1: Fuzzification
Fuzzifikasi: menentukan derajat keanggotaan
input x1 dan y1 pada himpunan fuzzy
1 1 B1 B2
A1 A2 A3 0.7
0.5
0.2 0.1
0 0
x1 X y1 Y
(x = A1) = 0.5 (y = B1) = 0.1
(x = A2) = 0.2 (y = B2) = 0.7
18
Step 2: Rule Evaluation
19
Step 2: Rule Evaluation
1 1 1
A3 B1 C1 C2 C3
0.1 OR 0.1
0.0
0 0 (max)
x1 X y1 Y 0 Z
Rule 1: IF x is A3 (0.0) OR y is B1 (0.1) THEN z is C1 (0.1)
1 1 1
0.7
C1 C2 C3
A2 0.2 B2 AND 0.2
(min)
0 x1 X 0 y1 Y 0 Z
Rule 2: IF x is A2 (0.2) AND y is B2 (0.7) THEN z is C2 (0.2)
1 1
A1 0.5 0.5 C1 C2 C3
0 x1 X 0 Z
Rule 3: IF x is A1 (0.5) THEN z is C3 (0.5)
20
Step 3: Aggregation of the rule
outputs
Agregasi keluaran semua rule ke dalam himpunan
fuzzy tunggal.
1 1 1
C1 C2 C3
0.5 0.5
0.2 0.2
0.1 0.1
0 Z 0 Z 0 Z 0 Z
z is C1 (0.1) z is C2 (0.2) z is C3 (0.5)
21
Step 4: Defuzzification
Defuzzifikasi: konversi dari himpunan fuzzy yang
dihasilkan dari komposisi ke dalam crisp value.
x x dx
A
COG a
b
x dx
a
A
22
Five commonly used defuzzifying
methods:
Centroid of area (COA)
Bisector of area (BOA)
Mean of maximum (MOM)
Smallest of maximum (SOM)
Largest of maximum (LOM)
23
Model Fuzzy Mamdani
Centre of gravity (COG): mencari titik yang membagi
area solusi menjadi 2 bagian yang sama
Degree of
Membership
1.0
0.8
0.6
0.4
0.2
0.0
0 10 20 30 40 50 60 70 80 90 100
67.4 Z
24
Latihan
Mengevaluasi mahasiswa berdasarkan GPA dan nilai
GRE
25
Fungsi Keanggotaan untuk GPA
26
Soal E
P F G VG
1.0
0 60 70 80 90 100
Decision
E = Excellent
VG = Very Good
G = Good
F = Fair
P = Poor 27
GRE
H = High
H M L M = Medium
G L = Low
P
A H E VG F
M G G P
L F P P
E = Excellent F = Fair
VG = Very Good P = Poor
G = Good 28
Model Fuzzy Sugeno
Inferensi Mamdani tidak efisien karena melibatkan
proses pencarian centroid dari area 2 dimensi.
29
Model Fuzzy Sugeno
Perbedaan antara Mamdani dan Sugeno ada pada
konsekuen. Sugeno menggunakan konstanta atau
fungsi matematika dari variabel input:
IF x is A IF x is A
AND y is B AND y is B
THEN z is f(x, y) THEN z is k
30
Examples
R1: if X is small and Y is small then z = x +y +1
0 x1 X 0 k3 Z
Rule 3: IF x is A1 (0.5) THEN z is k3 (0.5)
32
Model Fuzzy Sugeno
Step 3: Aggregation of the rule outputs
1 1 1 1
0.5 0.5
0.2
0.1 0.2 0.1
0 k1 Z 0 k2 Z 0 k3 Z 0 k1 k2 k3 Z
33
Model Fuzzy Sugeno
Defuzzifikasi
0 z1 Z
Crisp Output
z1
34
Model Fuzzy Sugeno: Contoh
35
L1: Fuzzification (1)
0 40 45 50 55 60 65 80 85
36
L2: Rules Evaluation (1)
Tentukan rules
Tabel Kaidah Fuzzy
BERAT
Sangat Sangat
Kurus Biasa Berat
kurus berat
T Sangat
I pendek SS S AS TS TS
N
G Pendek S SS S AS TS
G
I Sedang AS SS SS AS TS
Tinggi TS S SS S TS
Sangat
tinggi TS AS SS S AS
37
L2: Rules Evaluation (2)
Contoh: bagaimana kondisi kesehatan untuk orang dengan tinggi 161.5 cm
dan berat 41 kg?
Sangat Sangat
pendek Pendek Sedang Tinggi tinggi
1.0
0.7
0.3
38
L2: Rules Evaluation (3)
Sangat Sangat
kurus Kurus Biasa Berat berat
1.0
0.8
0.2
0 40 45 55
39
BERAT
Sangat
0.8 0.2 Biasa Berat
berat
T Sangat
I pendek SS S AS TS TS L2: Rules
N
G Pendek S SS S AS TS Evaluation (4)
G
I 0.7 AS SS SS AS TS
0.3 TS S SS S TS
Sangat
tinggi TS AS SS S AS
BERAT
Sangat
0.8 0.2 Biasa Berat
berat
Sangat
SS S AS TS TS
Pilih bobot minimum T
I
pendek
Diperoleh:
f = {TS, AS, S, SS} = {0.3, 0.7, 0.2, 0.2}
Penentuan hasil akhir, ada 2 metoda:
1. Max method: index tertinggi 0.7
hasil Agak Sehat
41
Summary
• Ada 4 tahapan utama sistem pakar fuzzy:
fuzzifikasi, inferensi, komposisi, defuzzifikasi.
• 2 metoda yang paling banyak dipakai: Mamdani
dan Sugeno.
• Metoda Mamdani menggunakan himpunan fuzzy
sebagai konsekuen rule, Metoda Sugeno
menggunakan fungsi matematik atau konstanta.
• Mamdani: komputasi lebih berat, human-like
inference, Sugeno: komputasi lebih efisien tetapi
kehilangan interpretabilitas linguistik.
42