Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 67

KECERDASAN BERBASIS

PENGETAHUAN

INFERENSI DALAM
KETIDAK PASTIAN
KECERDASAN BERBASIS
PENGETAHUAN

CERTAINTY FACTOR
Uncertainty: Introduction

 Dalam Sistem berbasis pengetahuan, sering kali


sistem harus mengambil kesimpulan yang benar
dari bukti yang lemah dan tidak pasti

 Bukan hal yang mustahil. Sering kita lakukan


dengan sukses dalam hampir semua aspek
kehidupan kita untuk dapat bertahan hidup.

3
Uncertainty: Introduction

 Misal :
- kita mengerti suatu kalimat yang tidak lengkap
- Dokter memberikan medical treatment yang
benar untuk symptom yang ambigu;

 Salah satu karakteristik dari informasi yang tersedia bagi


seorang pakar adalah ketidaksempurnaan, yaitu informasi
dapat : incomplete, inconsistent, uncertain

4
So, how to define the term “Uncertainty”?

 Uncertainty didefinisikan sebagai : kurangnya ”exact


knowledge” yang memungkinkan kita membuat
konklusi yang tepat.
 Hal ini disebabkan karena informasi yang tersedia
tidak sempurna, seperti : tidak konsisten, tidak
lengkap, tidak pasti
 Can be a problem because it may prevent us from
making the best decision or may even cause bad
decision to be made

5
So, how to define the term “Uncertainty”?

 Reasoning under uncertainty involves 3 important


issues:
 How to represent uncertain data
 How to combine two or more pieces of uncertain
data
 How to draw inference using uncertain data
There are many approaches to
representing uncertainty in AI.

7
Uncertainty Handling Methods

E.g. Suppose:
 Abductive reasoning If x is a bird then x flies

 Property inheritance Abductive reasoning would say that


“All fly things are birds”
 Fuzzy logic By property inheritance
“All birds can fly”
 Certainty Factor (CF) but, remember the case that
Penguin cannot fly?
 Bayes theorem
 Dempster-Shafer theory

8
Evaluation Criteria for
uncertainty handling methods

 Expressive power
 Logical correctness
 Computational efficiency of
inference

9
Scheme used by expert system in
Handling Uncertainty

 MYCIN (sistem pakar deteksi penyakit kelainan


darah ) uses Certainty Factor
 The CF can be used to rank hypotheses in order of
importance.
 For example if a patient has certain symptoms that suggest
several possible diseases, then the disease with the higher
CF would be the one that is first investigated.
 PROSPECTOR (sistem pakar untuk eksplorasi
mineral) uses Bayes theorem

10
UNCERTAIN EVIDENCE
 Representing uncertain evidence
CF (E) = CF (It will probably rain today)
= 0.6
 Similar to P(E), however, CF are not probabilities
but measures of confidence
 Derajat yang menunjukkan kita percaya bahwa
fakta benar
 It written as exact term but add CF value to it
Example: It will rain today CF 0.6
Certainty Theory
 Certainty factors measure the confidence that is
placed on a conclusion based on the evidence
known so far.
 Certainty factors combine belief and disbelief
into a single number based on some evidence
 A certainty factor is the difference between the
following two components :
CF = MB[h:e] - MD[h:e]

A positive CF means the evidence supports the hypothesis since MB > 12


MD.
Certainty Theory

1. Measures of Belief (MB)


Number that reflects the measure of increased belief
in a hypothesis H based on evidence E
0  MB  1

2. Measures of Disbelief (MD)


Number that reflects the measure of increase
disbelief in a hypothesis H based on evidence E
0  MD  1
Certainty Theory

3. Certainty Factor
Number that reflects the net level of belief in a
hypothesis given available information
CF = MB - MD
-1  CF 1
Certainty Theory

 Uncertain evidence is given CF or certainty factor value


ranging from -1 (completely false ) to 1 (completely true).

 Negative values degree of disbelief

 Positive values degree of belief

 Range of CF values

false Possibly False Unknown Possible True True


-1 0 1
Measures of disbelief Measures of bilief
Certainty Theory: Values Interpretation

Definitely Not -1.0


Almost certainly not -0.8
Probably not -0.6
Maybe not -0.4
Unknown -0.2 to 0.2
Maybe 0.4
Probably 0.6
Almost Certainly 0.8
Definitely 1.0
Certainty Theory
 Basic structure of rule in certainty model
IF E THEN H CF (Rule)

 CF (Rule) = level of belief of H given E

 Given that E is true, we believe H according to:


CF (H, E) = CF (Rule)
Certainty Theory

 Example:
IF There are dark cloud -E
THEN It will rain - H CF = 0.8

 This rule reads:


“If there are dark clouds then it will almost
certainly rain”

 CF (H, E) similar P (H|E)


Certainty Factor Propagation (C.F.P)

CFP FOR SINGLE PREMISE RULE


Menetapkan tingkat kepercayaan pada konklusi suatu rule (H)
ketika fakta (E) yang termuat dalam rule premise tidak pasti

CF (H, E) = CF (E) X CF (RULE)

Example
From previous rule:
CF (E) = 0.5
C.F.P. is
CF (H, E) = 0.5 x 0.8
= 0.4 #
In words: It maybe raining
Certainty Factor Propagation (C.F.P)

For same rule, with negative evidence for rule premise


to the degree of CF (E) = -0.5

C.F.P is
CF (H, E) = -0.5 * 0.8
= -0.4 #

In words: It maybe not raining.


Certainty Factor Propagation (C.F.P)

CFP FOR MULTIPLE RULE PREMISE

 For rules with more than one premises:


– conjunctive rules (AND)
– disjunctive rules (OR)
Certainty Factor Propagation (C.F.P)

CFP FOR MULTIPLE RULE PREMISE

 Conjunctive Rule
IF EI AND E2 AND ... THEN H CF (RULE)
CF (H, E1 AND E2 AND..) = min {CF (Ei)} * CF
(RULE)

 min function returns minimum value of a set of


numbers.
Certainty Factor Propagation (C.F.P)

Example:
IF The sky is dark
AND The wind is getting stronger
THEN It will rain CF = 0.8
Assume:
CF (the sky is dark) = 1.0
CF (the wind is getting stronger) = 0.7
CF (It will rain) = min {1.0,0.7} * 0.8
= 0.56 #
In words: It probably will rain
Certainty Factor Propagation (C.F.P)

CFP FOR MULTIPLE RULE PREMISE

 Disjunctive Rule (OR)

IF E1 OR E2 OR ... THEN H CF (RULE)


CF (H, E1 OR E2 OR..) = Max {CF (Ei)} * CF
(RULE)

 Max function returns the maximum value of a set


of numbers
Certainty Factor Propagation (C.F.P)

 Example:
IF the sky is dark
OR the wind is getting stronger
THEN It will rain CF = 0.8
CF (It will rain) = max {1.0, 0.7} * 0.8
= 0.8 #

 In words: It almost certainly will rain


Certainty Factor Propagation (C.F.P)

CFP SIMILARLY CONCLUDED RULES


 For multiple rules that support a
hypothesis (same hypothesis)

 Consider from 2 individuals:


– weatherman
– farmer
Certainty Factor Propagation (C.F.P)

Rule 1
IF the weatherman says it is going to rain (E1)
THEN It is going to rain (H)
CF (Rule 1) = 0.8

Rule 2
IF the farmer says it is going to rain
(E2)
THEN It is going to rain (H)
CF (Rule 2) = 0.8
Certainty Factor Propagation (C.F.P)

 CF of both rules set to equal implying equal


confidence in the 2 sources

 Naturally more confident in conclusion


Certainty Factor Propagation (C.F.P)

FORMULA FOR INCREMENTALLY ACQUIRED EVIDENCE

CFcombined (CF1, CF2)


= CF1 + CF2 * (1 - CF1) Both  0

= CF1 + CF2 One  0


1 - min {|CF1|,|CF2|}

= CF1 + CF2 * (1 + CF1) Both  0


where,
CF1 = confidence in H established by one rule (RULE 1)
CF2 = confidence in it established by one rule (RULE 2)
CF1 = CF1 (H, E)
CF2 = CF2 (H, E)
Certainty Factor Propagation (C.F.P)

 There are 2 properties of the equations:


– Commutative:
 allow evidence to be gathered in any order
– Asymptotic:
 If more than one source confirm a
hypothesis then a person will feels more
confident. Incrementally add belief to a
hypothesis as new positive evidence is
obtained
Certainty Factor Propagation (C.F.P)

Example
Consider Rain Prediction: Rule 1 and 2
Explore several cases

Case 1: Weatherman and Farmer Certain in Rain


CF (E1) = CF (E2) = 1.0

CF1 (H, E1) = CF (E1) * CF (RULE 1)


C.F.P.
= 1.0 * 0.8 = 0.8 for
single
CF2 (H, E2) =CF (E2) * CF (RULE 2) Premise
Rule
= 1. 0 * 0.8 = 0.8
Certainty Factor Propagation (C.F.P)

Since both > 0,

CFcombine (CF1, CF2) = CF1 + CF2 * (1 - CF1)


= 0.8 + 0.8 * (1 - 0.8)
= 0.96 #

CF supported by > 1 rule can be incrementally


increase more confident
Certainty Factor Propagation (C.F.P)

Case 2: Weatherman certain in rain, Farmer certain no rain


CF (E1) = 1.0 CF (E2) = -1.0
CF1 (H, E1) = CF (E1) * CF (RULE 1)
= 1.0 * 0.8 = 0.8

CF2 (H, E2) = CF (E2) * CF (RULE 2)


= -1.0 * 0.8 = -0.8
Since either one < 0
CFcombined (CF1, CF2) = CF1 + CF2
1 - min {|CF1|,|CF2|}
= 0.8 + (-0.8)
1 - min {0.8,0.8}
=0#
CF set to unknown because one say “no” and the other one say “yes”
Certainty Factor Propagation (C.F.P)

Case 3: Weatherman and Farmer believe at different degrees that it


is going to rain
CF (E1) = -0.8 CF (E2) = -0.6
CF1 (H, E1) = CF (E1) * CF (RULE 1)
= -0.8 x 0.8
= -0.64
CF2 (H, E2) = CF (E2) * CF (RULE 2)
= -0.6 * 0.8
= -0.48
Since both < 0
CFcombined (CF1, CF2) = CF1 + CF2 * (1 + CF1)
= - 0.64 - 0.48 * (1 - 0.64)
= -0.81 #
Show incremental decrease when more than one source
disconfirming evidence is found
Certainty Factor Propagation (C.F.P)

Case 4: Several Sources Predict Rain at the same level of belief but one
source predicts no rain
If many sources predict rain at the same level, CF(Rain) = 0.8, the CF
value converge towards 1
CFcombined (CF1, CF2 ..) 0.999 = CFold
CFold = collected old sources info.
If new source say negative
CFnew = -0.8 then,
CFcombined (CFold, CFnew)
= CFold + CFnew
1 - min { CFold, CFnew }
= 0.999-0.8
1 - 0.8
= 0.995
Shows single disconfirming evidence does not have major impact
Certainty Factor Propagation (C.F.P)

CERTAINTY PROPAGATION FOR COMPLEX RULES


Combination of conjunctive and disjunctive statement
(“AND”, “OR”)

Example:
IF E1
AND E2
OR E3 max
AND E4
THEN H

CF (H;E)= Max {min (E1, E2), min (E3, E4)} * CF (RULE)


Certainty factors
 Consider two rules:
(R1) hasHair  mammal CF(R1) = 0.9
(R2) forwardEyes & sharpTeeth  mammal CF(R2) = 0.7
 We now know that:
 CF(hasHair) = 0.8 CF(forwardEyes) = 0.75 CF(sharpTeeth) = 0.3
 CF(forwardEyes  sharpTeeth) = min( 0.75, 0.3 ) = 0.3

Given the premise CF, how do you combine with the CF for the rule?
CF(H, Rule) = CF(E) * CF(Rule)
So, CF(mammal, R1) = CF(hasHair) * CF(R1) = 0.8 * 0.9 = 0.72
CF(mammal, R2) = CF(forwardEyes  sharpTeeth) * CF(R2)
= 0.3 * 0.7
= 0.21
Certainty factors

Given diff rules with same conclusion, how do you combine CF's?
CF(H, Rule1 & Rule2) = CF(H, Rule1) + CF(H, Rule2)*(1-
CF(H,Rule1))

So, CF(mammal, R1 & R2)


= CF(mammal, R1) + CF(mammal, R2)*(1-
CF(mammal,R1))
= 0.72 + 0.21*0.28
= 0.72 + 0.0588
= 0.7788

note: CF(mammal, R1 & R2) = CF(mammal, R2 & R1)


LATIHAN

 To Illustrate CF through a set of rules, we consider a small problem


of deciding whether or not I should go to a ball game.

 Assume the hypothesis “I should not go to the ball game”.

Rule 1
IF the weather looks lousy E1
OR I am in a lousy mood E2
THEN I shouldn’t go to the ball game H1 CF = 0.9
LATIHAN

Rule 2
IF I believe it is going to rain E3
THEN the weather looks lousy E1 CF = 0.8

Rule 3
IF I believe it is going to rain E3
AND the weatherman says it is going to rain E4
THEN I am in a lousy mood E2 CF = 0.9
LATIHAN

Rule 4
IF the weatherman says it is going to rain E4
THEN the weather looks lousy E1 CF = 0.7

Rule 5
IF the weather looks lousy E1
THEN I am in a lousy mood E2 CF = 0.95
LATIHAN

Assume the following CF:


I believe it is going to rain
CF(E3) = 0.95
Weatherman believes it is going to rain
CF(E4) = 0.85
Kelebihan Metode CF

 Suatu model komputasi yang sederhana


yang memungkinkan pakar mengestimasi
kepercayaaannya dalam konklusi
 Mengijinkan ekspresi kepercayaan dan
ketidakpercayaan dalam tiap hipotesis
 Menggabungkan nilai CF lebih mudah
dibandingkan metode lain
KECERDASAN
BERBASIS PENGETAHUAN

BAYES REASONING
TEORI PROBABILITAS

 Suatu pendekatan matematis untuk memproses


uncertain information
 probabilitas p(xi) adalah kemungkinan suatu kejadian
xiS terjadi
– Mengukur keyakinan seseorang bahwa suatu kejadian
terjadi
– non-negative values in [0,1]
– total probability of the sample space is 1
 p(xi , xiS) = 1
RUANG SAMPEL (S)

 himpunan semua hasil yang mungkin muncul atau


terjadi pada suatu percobaan statistik / himpunan
semua event yang mungkin

Contoh :
- pelemparan mata uang  S={M, B}
- pelemparan dadu  S = {1,2,3,4,5,6}

 What is the sample space for flipping a coin 3


times?
PENDEKATAN PROBABILITAS

– Objektif Probability
 Classical probability
- asumsi : keluaran dari suatu eksperimen
mempunyai kemungkinan sama
 Experimental probability

- berdasar pada frekuensi terjadinya suatu


kejadian
– Subjective probability (CF Theories, Dempster-
Shafer, ...)
 Berdasar pada penilaian ekspert
Contoh

– Coin: What is the probability of obtaining heads when


flipping a coin?
– A single dice: What is the probability I will roll a four?
– A jar of 30 red and 40 green jelly beans: What is the
probability I will randomly select a red jelly bean?
– Computer: In the past 20 times I used my computer, it
crashed 4 times and didn’t crash 16 times. What is the
probability my computer will crash next time I use it?
SIFAT PROBABILITAS

 Sifat probabilitas kejadian A :


a. 0  P(A)  1

b. P(S) = 1
P (rolling a 1 or 2 or 3 or 4 or 5 or 6) = 1

c. Probabilitas kejadian A atau B (joint probability)=


P (AB) = P(A) + P(B) – P(AB)
SIFAT PROBABILITAS (2)

d. Untuk 2 kejadian yang mutually exclusive (tidak ada 2


kejadian yang terjadi secara bersamaan pada waktu
yang sama) :
P (AB) = P(A) + P(B)

P (rolling a 1 or a 6) = P (rolling a 1) + P (rolling a 6)


= 1/6 + 1/6 = 2/6 or 1/3

e. P(A’) = 1-P(A)
P (not rolling a 5) = 1 – 1/6 = 5/6
SIFAT PROBABILITAS (3)

. Jika ada 2 kejadian A dan B independen (keluaran kejadian


f
1 tidak berpengaruh pada keluaran kejadian berikutnya)
P(AB) = P(A).P(B)

P (rolling a 1 and then a 6) = P(rolling a 1) * Pr(rolling a 6)


= (1/6)(1/6) = 1/36

g. Jika 2 kejadian tidak independen


P(AB) = P(A).P(B|A)
CONDITIONAL PROBABILITY

– Probabilitas bersyarat : event A given that event B


has already occurred
P( A  B)
P( A / B)  , P( B)  0
P( B)
Probabilitas Bersyarat Dalam Data
# Cuaca Temperatur Kecepatan Angin Berolah-raga
1 Cerah Normal Pelan Ya
2 Cerah Normal Pelan Ya
3 Hujan Tinggi Pelan Tidak
4 Cerah Normal Kencang Ya
5 Hujan Tinggi Kencang Tidak
6 Cerah Normal Pelan Ya

P(cuaca=cerah|olahraga = ya) = ?

Banyaknya data berolah-raga=ya adalah 4 dari 6 data maka :


P(Olahraga=Ya) = 4/6
Banyaknya data cuaca=cerah dan berolah-raga=ya adalah 4 dari 6 data maka:
P(cuaca=cerah dan Olahraga=Ya) = 4/6
4/6
P (cuaca  cerah | olahraga  ya)  1
4/6
Probabilitas Bersyarat Dalam Data
# Cuaca Temperatur Berolahraga
1 cerah normal ya
2 cerah tinggi ya
3 hujan tinggi tidak
4 cerah tinggi tidak
5 hujan normal tidak
6 cerah normal ya

P(cuaca=cerah, temperatur=normal | olahraga=ya)= ?

Banyaknya data berolah-raga=ya adalah 3 dari 6 data maka:


P(Olahraga=Ya) = 3/6
Banyaknya data cuaca=cerah, temperatur=normal dan berolah-
raga=ya adalah 2 dari 6 data maka :
P(cuaca=cerah, temperatur=normal, Olahraga=Ya) = 2/6
2/6 2
P (cuaca  cerah, temperatur  normal | olahraga  ya)  
3/ 6 3
CONDITIONAL PROBABILITY
P( A  B)
P( A | B) 
P( B)
P( B  A)
P( B | A) 
P( A)

P ( B  A)  P( B | A).P ( A)
P ( A  B )  P ( B | A).P ( A)
P ( B | A).P ( A)
P( A | B)  Bayesian Rule
P( B)
CONDITIONAL PROBABILITY

Jika kejadian B tergantung hanya pada 2 kejadian


yang mutually exclusive, yaitu A dan not A :
P( B )  P( B | A). P( A)  P( B | A). P(A)

P ( B | A).P ( A)
P( A | B) 
P ( B | A).P ( A)  P ( B | A).P (A)
BAYESIAN REASONING

 derive the probability of a cause given a symptom


 has gained importance recently due to advances in
efficiency
– more computational power available
– better methods
 especially useful in diagnostic systems
– medicine, computer help systems
 Misal rule dalam basis pengetahuan dinyatakan dalam
bentuk :
If E then H [dengan prob. p] yang berarti jika E
terjadi, maka probabiltas H akan terjadi adalah p.
BAYESIAN REASONING
Bayes’ Rule for Single Event
P ( E | H ). P ( H )
P( H | E ) 
P( E )
P ( E | H ).P ( H )
P( H | E ) 
P( E | H ).P ( H )  P ( E | H ).P (H )
P(H) = prior probability dari hipotesis H benar
P(E|H) = probabilitas hipotesis H benar akan mengakibatkan evidence
E
P(not H) = prior probability hipotesis H salah
P(E|not H) = probabilitas menemukan evidence E jika hipotesis H
salah
Prior probability dan conditional probability P(E|H) disediakan oleh
ekspert. User menyediakan evidence yang diamati dan sistem pakar
menghitung posterior probability P(H|E)
CONTOH

– Diketahui rule :
meningitis  sakit leher [prob= 0,8]
diketahui :
prob. seseorang menderita meningitis= 0,0001
prob. seseorang sakit leher = 0,1
Tentukan probabilitas seseorang kena meningitis jika
sakit leher.
 Misal M = meningitis, S = sakit leher maka:
P(M|S) = P(S|M) x P(M) / P(S)
= 0.8 × 0.0001 / 0.1 = 0.0008
BAYESIAN REASONING

 Single evidence and multiple hypoteses

P ( E | H i ). P ( H i )
P( H i | E )  m

 P( E | H
k 1
k ). P ( H k )
CONTOH

 Ani mengalami gejala ada bintik-bintik di wajahnya.


- prob. muncul bintik-bintik di wajah jika terkena cacar= 0,8
- prob. Ani terkena cacar tanpa memandang gejala
apapun=0,4
- prob. muncul bintik-bintik di wajah jika alergi = 0,3
- prob. Ani kena alergi tanpa memandang gejala apapun=
0,7
- prob. muncul bintik-bintik di wajah jika jerawatan = 0,9
- probabilitas Ani kena jerawat tanpa memandang gejala
apapun = 0,5
 Penyakit apa yang diderita Ani ?
BAYESIAN REASONING
 Multiple Evidence and multiple hypoteses

P( E1 E2 ...En | H i ).P( H i )
P( H i | E1 E2 ...En )  m

 P( E E ...E
k 1
1 2 n | H k ).P( H k )

P( E1 | H i ).P( E2 | H i ).....P( En | H i ).P( H i )


P( H i |E 1E2 ...En )  m

 P( E | H
k 1
1 k ).P( E2 | H k ).....P( En | H k ).P( H k )
CONTOH

 Diberikan 3 conditionally independent evidence E1, E2 dan E3


yang membentuk 3 hipotesis H1, H2 dan H3 yang mutually
exclusive. Diberikan juga nilai probabilitas prior dan
probabilitas kondisional oleh ekspert seperti pada tabel :

Hipotesis
Probabilitas i=1 i=2 i=3
P(Hi) 0,40 0,35 0,25
P(E1|Hi) 0,3 0,8 0,5
P(E2|Hi) 0,9 0,0 0,7
P(E3|Hi) 0,6 0,7 0,9
CONTOH

 Misal evidence yang pertama diamati adalah E3,


maka : P( E3 | H1 ).P( H1 )
P ( H 1 | E3 )  0, 6.0, 40
 0,6.0,400,7.0,350,9.0,25  0,34
P( E3 | H1 ).P( H1 )  P( E3 | H 2 ).P( H 2 )  P( E3 | H 3 ).P( H 3 )

 Dengan cara yang sama :


P(H2|E3)= 0,34
P(H3|E3)= 0,32
CONTOH
 Misal sekarang evidence E1 diamati :

P ( E1 | H1 ). P ( E3 | H1 ). P ( H1 ) 0,3.0,6.0,40
P ( H1 |E 1E3 )    0,19
m
0,3.0,6.0,40  0,8.0,7.0,35  0,5.0,9.0,25
 P( E
k 1
1 | H k ). P ( E3 | H k ). P ( H k )

 P(H2|E1 E3) = 0,52


 P(H3|E1 E3)= 0,29
CONTOH

 Misal E2 diamati, maka :


 P(H1|E1 E2E3)=0,45
 P(H2|E1 E2E3 )=0
 P(H3|E1 E2E3 )=0,55
Advantages:

- Most significant is their sound theoretical foundation in


probability theory.
- Most mature uncertainty reasoning methods
- Well defined semantics for decision making

Main disadvantage:

- They require a significant amount of probability data


to construct a knowledge base.

67

You might also like