Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 37

Sistem Berbasis Pengetahuan

Inferensi dan Reasoning


Rita Rahmawati, S.T, M.T
Ria Chaniago, S.T, M.T

1
Inferensi
● Inferensi → Proses untuk menghasilkan informasi baru dari informasi yang
telah diketahui
● Mesin Inferensi (Inference Engine) → Sebuah Modul / Program / Bagian yang
dapat melakukan proses inferensi
● Contoh MEsin Inferensi :
○ Forward Chain
○ Backward Chain
● Mesin Inferensi akan mengendalikan seluruh proses reasoning

● Inference → The Result of Reasoning

2
Reasoning : the action of thinking about something in a logical, sensible way
3
Reasoning
● Definisi : Proses bekerja dengan pengetahuan, fakta dan dan strategi
pemecahan masalah, untuk mengambil suatu kesimpulan.
● (Berpikir dan mengambil kesimpulan)

● Metode Reasoning:
○ Deductive Reasoning
○ Inductive Reasoning
○ Abductive Reasoning
○ Analogical Reasoning
○ Common Sense Reasoning

4
Ilustrasi Wumpus World

5
Wumpus World
• Monster bernama Wumpus tinggal di gua
yang terbagi dalam 16 ruangan.
• Ada 3 kotak mematikan (Pit) yang
mengeluarkan angin (Breeze) ke sekitarnya.
• Wumpus mengeluarkan bau busuk (Stench).
• Wumpus menjerit (Scream) saat mati
terkena panah
• Jika agent menabrak dinding gua maka
benjol (Bump)
• Agent harus memanah Wumpus atau
mengambil Gold.

6
Agent in a Wumpus world: Percepts
• The agent perceives
• a stench in the square containing the wumpus and in the
adjacent squares (not diagonally)
• a breeze in the squares adjacent to a pit
• a glitter in the square where the gold is
• a bump, if it walks into a wall
• a woeful scream everywhere in the cave, if the wumpus is
killed

7
Representasi Formal
● 5 Simbol : ● Jika kondisi yang diterima agen
○ Stench ○ Ada Stench
○ Glitter ○ Ada Glitter
○ Breeze ○ Tidak ada Breeze
○ Bump ○ Tidak ada Bump
○ Scream ○ Tidak ada Scream

[Stench, Breeze, None, None, None]

8
Wumpus Action

• go forward • climb is used to leave


• turn right 90 degrees the cave. Only effective
in start field.
• turn left 90 degrees
• die, if the agent enters a
• grab means pick up an square with a pit or a
object that is in the live wumpus. (No take-
same square as the backs!)
agent
9
Wumpus Goals

Menemukan Gold dengan


• 1000 points reward for
selamat. climbing out of the cave
with the gold
• 1 point deducted for
every action taken
• 10000 points penalty for
getting killed

10
(1,4) (2,4) (3,4) (4,4)
• A = Agent
• B = Breeze
(1,3) (2,3) (3,3) (4,3)
• G = Glitter, Gold
• OK = Safe Square
(1,2) (2,2) (3,2) (4,2)
• P = Pit
• S = Stench Ok
• V = Visited (1,1) (2,1) (3,1) (4,1)
A
• W Wumpus OK ok

• [None, None, None, None, None]


11
[Stench, Breeze, Glitter, Bump, Scream]
(1,4) (2,4) (3,4) (4,4)
1. [None, None, None, None, None]

(1,3) (2,3) (3,3) (4,3)

(1,2) (2,2) (3,2) (4,2)

Ok
(1,1) (2,1) (3,1) (4,1)
A
OK ok

12
1. [None, None, None, None, None]
2. [None, Breeze, None, None, None]

(1,4) (2,4) (3,4) (4,4)

(1,3) (2,3) (3,3) (4,3)

(1,2) (2,2) (3,2) (4,2)

Ok
(1,1) (2,1) (3,1) (4,1)
A
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 13


1. [None, None, None, None, None]
2. [None, Breeze, None, None, None]

(1,4) (2,4) (3,4) (4,4)

(1,3) (2,3) (3,3) (4,3)

(1,2) (2,2) (3,2) (4,2)

Ok
(1,1) (2,1) (3,1) (4,1)
A
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 14


1. 1,1 [None, None, None, None, None]
2. 2,1 [None, Breeze, None, None, None] Back to save place!
(1,4) (2,4) (3,4) (4,4)

(1,3) (2,3) (3,3) (4,3)

(1,2) (2,2) (3,2) (4,2)


pit?
Ok
(1,1) (2,1) (3,1) (4,1)
A pit?
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 15


1. 1,1 [None, None, None, None, None]
2. 2,1 [None, Breeze, None, None, None]
3. 1,2 [Stench, None, None, None, None]
(1,4) (2,4) (3,4) (4,4)

(1,3) (2,3) (3,3) (4,3)


W

(1,2) (2,2) (3,2) (4,2)


A pit?
Ok
(1,1) (2,1) (3,1) (4,1)
pit?
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 16


1. 1,1 [None, None, None, None, None]
2. 2,1 [None, Breeze, None, None, None]
3. 1,2 [Stench, None, None, None, None]
4. 2,2 [None, None, None, None, None] (1,4) (2,4) (3,4) (4,4)

(1,3) (2,3) (3,3) (4,3)


W

(1,2) (2,2) (3,2) (4,2)


A
Ok
(1,1) (2,1) (3,1) (4,1)
pit?
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 17


1. 1,1 [None, None, None, None, None]
2. 2,1 [None, Breeze, None, None, None]
3. 1,2 [Stench, None, None, None, None]
4. 2,2 [None, None, None, None, None] (1,4) (2,4) (3,4) (4,4)
5. 3,2 [None, Breeze, None, None, None]

(1,3) (2,3) (3,3) (4,3)


W pit?

(1,2) (2,2) (3,2) (4,2)


A pit?
Ok
(1,1) (2,1) (3,1) (4,1)
pit?
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 18


1. 1,1 [None, None, None, None, None]
2. 2,1 [None, Breeze, None, None, None] Back to save place!
3. 1,2 [Stench, None, None, None, None]
4. 2,2 [None, None, None, None, None] (1,4) (2,4) (3,4) (4,4)
5. 3,2 [None, Breeze, None, None, None]

(1,3) (2,3) (3,3) (4,3)


W pit?

(1,2) (2,2) (3,2) (4,2)


A pit?
Ok
(1,1) (2,1) (3,1) (4,1)
pit?
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 19


1. 1,1 [None, None, None, None, None]
2. 2,1 [None, Breeze, None, None, None] GOLD, WIN
3. 1,2 [Stench, None, None, None, None]
4. 2,2 [None, None, None, None, None] (1,4) (2,4) (3,4) (4,4)
5. 3,2 [None, Breeze, None, None, None]
6. 2,3 [Smell, Breeze, Glitter, None, None]
(1,3) (2,3) (3,3) (4,3)
W pit?

(1,2) (2,2) (3,2) (4,2)


pit?
Ok
(1,1) (2,1) (3,1) (4,1)
pit?
OK ok

[Stench, Breeze, Glitter, Bump, Scream] 20


[pengingat] Knowledge Based Agent Concept
• Knowledge Inference
Reasoning
representation language
• Inference

ag sed ge
ba led
ow
• Have background

t
en
Re ang

Kn

ge
pre ua

Kn orld
L

led
knowledge about the

sen g e

W
ow
tat
world

ion
21
Propositional logic: Syntax
•Propositional logic is the simplest logic—illustrates basic ideas

•The proposition symbols P1, P2 etc are sentences If S is a

sentence, ¬S is a sentence (negation)


•If S1 and S2 are sentences, S1 ∧ S2 is a sentence (conjunction)

•If S1 and S2 are sentences, S1 ∨ S2 is a sentence (disjunction)

•If S1 and S2 are sentences, S1 ⇒S2 is a sentence (implication)

•If S1 and S2 are sentences, S1 ⇔S2 is a sentence (biconditional) - iff

22
● P > Sentences
● S > 1 Sentence
● ~S > Negasi

23
Propositional logic: Semantics

24
Truth Table

25
Wumpus world sentences

26
Truth tables for inference

27
Case Based Reasoning

28
Case-Based System
● Instead of facts and rules, CBR systems use cases and their entire
solutions.
● CBR is based on the concepts of similarity and analogy
○ Similarity is used to find similar cases
○ analogy is used to find solutions for similar cases

29
Case-Based System

● Case Based Reasoning (CBR) is the process of solving new problems based
on the solutions of similar past problems.

● Koleksi dari kasus-kasus historis dan penyelesaiannya membentuk


Knowledge Base.

30
Case-Based System Cycle

31
Operation cycle of CBR

In general, can be described using four REs:


● REtrieve the most similar case or cases.
● REuse the case(s) to attempt to solve the problem.
● REvise the proposed solution if necessary.
● REtain the new solution as a part of a new case.

32
Case Based Reasoning Process
● Retrieve

Retrieve adalah proses mencari kasus yang serupa dengan kasus yang tersimpan
dalam basis data, serta memunculkan solusi yang relevan dengan kasus
tersebut.

● Reuse

Proses ini adalah proses dimana pemilihan informasi apa saja dari kasus
sebelumnya yang dapat digunakan kembali dalam kasus yang dihadapi sekarang.

33
Case Based Reasoning Process
● Contoh Algoritma untuk Retrieval dan Reuse
○ Nearest - Neighbour
○ K Nearest - Neighbor

● Mencari jarak
○ Euclidean Distance

○ Manhattan Distance

34
Case Based Reasoning Process (2)
● Revise

Revise adalah proses dimana evaluasi dilakukan, mengkalkulasi dan


mempertimbangkan solusi kasus yang telah didapatkan dari proses sebelumnya, jika
solusi dapat berhasil dijalankan maka proses akan berlanjut ke dalam proses retain.

● Retain

Retain adalah proses penyaringan sebuah informasi dari kasus dan solusi yang baru
yang nantinya akan disimpan ke dalam basis data. Informasi yang disimpan akan
digunakan kembali ketika ada kasus serupa yang terjadi.

35
Case-Based System

● Because the new case is most likely different from


all the old cases, the solution of a retrieved case
can be revised or adapted.

● If the solution was a success, then the new case is


retained in the database together with the new
solution. ● R : retrieval of a similar case
from problem space
● A : adaptation of a solution from
solution space

36
Contoh Implementasi
● Sistem pakar kesehatan
● Forecasting : Weather
● Automatic Help Desk
● Trouble Shooting

37

You might also like