Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is...

23
10/21/2015 1 REPRESENTASI PENGETAHUAN Sistem Pakar Departemen Ilmu Komputer Fakultas Matematika dan Ilmu Pengetahuan Alam Institut Pertanian Bogor 2015 Tahap Pengembangan Sistem Pakar (Marimin,2002) Mulai Identifikasi Masalah Mencari Sumber Pakar Akuisisi Pengetahuan Representasi Pengetahuan Membuat Mesin Inferensi Implementasi Pengujian Mewakili Kepakaran ? Selesai ya tidak

Transcript of Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is...

Page 1: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

1

REPRESENTASI PENGETAHUAN

Sistem Pakar

Departemen Ilmu Komputer Fakultas Matematika dan Ilmu Pengetahuan Alam

Institut Pertanian Bogor

2015

Tahap Pengembangan Sistem Pakar (Marimin,2002)

Mulai

Identifikasi Masalah

Mencari Sumber

Pakar

Akuisisi Pengetahuan

Representasi Pengetahuan

Membuat Mesin Inferensi

Implementasi

Pengujian

Mewakili

Kepakaran ?

Selesai

ya

tidak

Page 2: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

2

Representasi Pengetahuan

Knowledge is Power

“Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa

knowledge sangat berperan vital dalam pengembangan Sistem Pakar “

Overview

What is Knowledge and How to Capture ?

Cara untuk menstrukturkan/memformalkan suatu pengetahuan hasil akuisisi

Mengapa dilakukan ?

Hasil akuisisi tidak selalu terstruktur (terkait : karakteristik pakar, sifat

data )

Memudahkan dalam membuat mesin inferensi

Representasi Pengetahuan

“ KR is a subarea of artificial intelligence concerned with understanding, designing, and implementing ways and impementing ways of representing information so that

program can use it”

Page 3: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

3

Object – atribut – value (OAV) triplet

Rules

Semantic Network

Frame

Predicate Logic

Fuzzy Representation

Teknik Representasi Pengetahuan

Fakta yang terdapat bahwa setiap objek memiliki properti

atau atribut dengan nilai tertentu.

Atribut tersebut bisa tunggal dan bisa jamak

1. Object – Atribut – Value (OAV) triplet

Chair Brown color

Fig 1. objek – atribut – value (durkin, 1994)

Ball Brown

1 meter

100 gram

color

diameter

weight

Page 4: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

4

Example of Expert Systemusing OAV

1.1 Single Vs Multiple Value Facts

Question : Please tell me if the barometric pressure is ?

Falling

Steady

Rising

Answer : Falling

Question : Please select the level of education ?

High School

College

Graduate School

Answer : High School

College

OAV-Single

Value

OAV-

Multiple

Value

Rule is a form of procedural knowledge

Logically, rule’s structure connect one or more antecendent (IF Part) to

one or more consequent (THEN Part)

2. Rules

“ A Knowledge Structure that related some known information to other information that can be concluded or inferred to be known”

IF Today’s time is after 10 am

AND Today is weekday

AND I am at home

OR My boss called and said that I am late for work

THEN I am late for work

ELSE I am not late for work

Page 5: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

5

Example Rule-base system

2. Rules (cont…)

Q : Ball’s color ?

A : Red

IF Ball’s Color is Red

THEN I Like the Ball

IF I Like the Ball

THEN I Will buy the Ball

Ball’s Color is Red

I Like the Ball

I Will Buy the Ball

Knowledge Base

Working Memory

E

Database

A B C D

X

Match Fire

Knowledge Base

X & B & E Y

Z Y & D

L C

L & M

A X

N

E

Forward chaining

E

X

Database

A B C D

Match Fire

Knowledge Base

X & B & E Y

Z Y & D

L C

L & M

A X

N

L

Cycle One

Page 6: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

6

Match Fire

Knowledge Base

Database

A C D E

Y

B

L X

X & B & E Y

Z Y & D

L C

L & M

A X

N

Match Fire

Knowledge Base

Database

A C D E

L

B

X

X & B & E Y

Z Y & D

L C

L & M

A X

N

Forward chaining

Cycle Two Cycle Three

Y Z

Forward chaining Example Rule 1

If patient has sore throat

And suspect a bacterial Infection

Then patient has strep throat

Rule 2

If patient temperature > 100

Then patient has a fever

Rule 3

If patient has been sick over one month

And patient has a fever

Then we suspect a bacterial Infection

Page 7: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

7

Forward chaining Example

Cycle 1: Rule 2 true -> conclude

Patient has a fever

patient temperature = 102

patient been sick for two months

patient has sore throat

Database

patient has a fever

bacterial infection

patient has strep throat

Cycle 3: Rule 1 true -> conclude patient has

strep throat

Cycle 2: Rule 3 true -> conclude

bacterial infection

Backward Chaining – Goal Driven

In contrast backward chaining:

goal driven, try to prove a specific goal

Work backwards from a conclusion and try to

reach a set of conditions which establish that

conclusion.

Start with a goal and use this to establish a set of

sub-goals.

continue until goal is proved (or disproved), or no

more matches

Page 8: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

8

Backward chaining Backward chaining is the goal-driven reasoning. In backward chaining, an expert system has the goal (a

hypothetical solution) and the inference engine attempts to find the evidence to prove it.

First, the knowledge base is searched to find rules that might

have the desired solution. Such rules must have the goal in their THEN (action) parts. If such a rule is found and its IF (condition) part matches

data in the database, then the rule is fired and the goal is proved.

However, this is rarely the case.

Backward chaining Thus the inference engine puts aside the rule it is

working with (the rule is said to stack)

And sets up a new goal, a subgoal, to prove the IF part of this rule

The knowledge base is searched again for rules that can prove the subgoal

The inference engine repeats the process of stacking the rules until no rules are found in the knowledge base to prove the current subgoal

Page 9: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

9

Backward Chaining – Example 1

Goal: Z

Knowledge Base

Pass 1

Database

B C D E A

Z

X & B & E Y

L C

L & M

A X

N

Z Y & D

Knowledge Base

Sub-Goal: Y

A B C D E

Y

?

X & B & E Y

Z Y & D

L C

L & M

A X

N

Pass 2

Database

Sub-Goal: X

Knowledge Base

A B C D E

X

?

L C

L & M N

X & B & E Y

Z Y & D

A X

Pass 3

Database

Backward Chaining – Example 1

Goal: Z

Knowledge Base

A C D E

Z Y

B

X

Match Fire

X & B & E Y

Z Y & D

L C

L & M

A X

N

Pass 6

Database

Match Fire

Knowledge Base

A B C D E

X

Sub-Goal: X

Pass 4

X & B & E Y

Z Y & D

L C

L & M

A X

N

Database

Sub-Goal: Y

Match Fire

Knowledge Base

A C D E

Y X

B

X & B & E Y

L C

L & M

A X

N

Z Y & D

Pass 5

Databas

e

Page 10: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

10

Backward Chaining - Example 2

Rule 1

If patient has sore throat

And suspect a bacterial Infection

Then patient has strep throat

Rule 2

If patient temperature > 100

Then patient has a fever

Rule 3

If patient has been sick over one month

And patient has a fever

Then we suspect a bacterial Infection

Start with same set of facts:

patient temperature = 102

patient has been sick for two months

patient has sore throat

But now start with goal

Patient has a strep throat

And try to prove this given the

rules and the facts.

Example 2 : Backward Chaining

Strep throat?

Sore throat

bacterial infection

fever

Temp>100

Sick > One month

Page 11: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

11

Rule can represent various of knowledge

2.2 Type of Rules

a. Relationship

IF The battery is dead

THEN The car will not start

b.Recomendation

IF The car will not start

THEN Take a carb

c. Directive

IF The car will not start

AND The fuel system os ok

THEN Check out the electrical system

d. Heuristic

IF The car will not start

AND The car is a 1957 Ford

THEN Check the float

Just as you can have uncertain fact.

2.3 Uncertain Rule

IF Inflation is high

THEN Almost certainly interest rate are high

You can use value CF for Almost Certaintly

IF Inflation is high

THEN Interest rate are high (CF = 0.8)

Page 12: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

12

Rule yang yang mendeskripsikan bagaimana rule lain harus

digunakan

2.4 Meta Rule

IF The car will not start

AND The electrical systemis operating normally THEN Use Rule concerning the fuel system

A method of knowledge representation using graph made

up and arcs where the node represent objects and the

arcs the relationships between the object

3. Semantic Network

Relation in Semantic Network :

IS-A

HAS

TRAVEL

BREATHE

Page 13: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

13

3.1 Semantic Network

Tweety Canary BIRD

Wings

Penguin

Walk

Fly

Animal

Air

IS-A IS-A

IS-A

IS-A

TRAVEL

TRAVEL

HAS BREATHE

Objek baru:

1. Similar Object

2. More spesific Object

3. More General Object

Inheritance sebagai salah satu fitur dalam semantic

network

Objek yang lebih spesifik akan memiliki sifat yang

diturunkan dengan relasi IS-A

Sebagi contoh :

Tweety bernapas dengan udara karena di adalah Burung

3.2 Inheritance in SN

Page 14: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

14

Meskipun inheritance powerful, namun memiliki kelemahan.

Perhatikan contoh berikut:

3.3 Exception Handling

BIRD

Penguin

Walk

IS-A

TRAVEL

Pada Exception Handling,

mempersyaratkan untuk

menghitung

pengecualian(excption) pada

lokal.

Ketika suatu node

menurunkan informasi yang

tidak benar, buat link node

baru yang dapat secara

efektif melakukan over-ride

Perhatikan narasi di bawah ini !

Pada suatu ekosistem terdapat beberapa jenis hewan. Berdasarkan ukurannya, hewan di ekosistem tersebut dapat digolongkan menjadi hewan berbadan besar dan hewan berbadan kecil. Di antara hewan kecil adalah tupai, tikus kucing dan kalajengking. Di ekosistem tersebut semua kalajengking berwarna hitam. Secara umum, tikus yang terdapat di ekosistem itu berwarna hitam meskipun tidak menutup kemungkinan ada juga beberapa yang berwarna putih. Adapun kucing, dengan suaranya yang khas (mengeong) sebagian memiliki warna putih dan sebagian memiliki warna hitam. Tikus memiliki suara gaduh dengan mencicit sedangkan tupai tidak mencicit seperti tikus.

Hewan lainnnya yang terdapat di ekosistem tersebut antara lain: gajah, jerapah, badak, kuda nil, banteng, rusa, hyna dan harimau. Dari sejumlah hawan berbadan besar hanya jerapah yang memiliki leher panjang . Hewan berbadan besar lainnya tidak memiliki leher sepanjang jerapah. Di antara hewan yang tidak berleher panjang (pendek) ada yang memiliki belalai yaitu gajah dan ada yang tidak memiliki belalai, yaitu badak kuda nil banteng dan harimau. Dari hewan berleher pendek ini hanya kuda nil saja yang suka berendam di air sedangkan lainnya tidak. Gajah dan banteng sama-sama memakan rerumputan atau dedaunan hanya saja gajah jauh lebih banyak daripada banteng dan rusa karena memang kebutuhannya yang sangat banyak. Dari hewan yang berbadan besar yang ada, harimau dan hyna suka makan daging, hanya saja harimau berburu sendiri tapi hyna makan daging sisa saja.

3.3 Latihan Semantic Network

TUGAS

Page 15: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

15

Data Structure for Representing stereotype knowledge of some concept or

object.

4. Frame

Report Card

Name

Address

course grade

……… ……….

……… ……….

……… ……….

……… ……….

Frame

Name

class Object 2

course grade

……… ……….

……… ……….

……… ……….

……… ……….

Object 1

Basic structure analogue

[Minsky, 1981]:

A Frame is a collection of questions to be asked about a hypothetical situation: it

specifies issues to be raised and methods to be used in dealing with them.

4. Frame

To understand a situation, questions like:

• What caused it (agent)?

• What was the purpose (intention)?

• What are the consequences (effects)?

• Whom does it affect (recipient)?

• How is it done (instruments)?

Page 16: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

16

Merepresentasikan karakteristik umum dari sekumpulan objek

Pada setiap class frame, kita mendefinisakan properties baik yang umum

untuk semua objek dan memberikan nilai default

Terdapat properti yang statis dan dinamis

Static Properties : nilai tidak berubah

Dinamic Properties : nilai dapat berubah

4.1 Class Frame

color Unknown

Eats Worm

Num_wings 2

Flies True

Activity Unknown

Frame Name Bird

Page 17: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

17

Merupakan bentuk representasi pengetahuan yang paling

tua

Menggunakan Simbolik untuk merepresentasikan

pengetahuan dan operator untuk untuk memproduksi

penalaran logis

Yang paling sering dikatikan dengn bidang AI/ES

Logika Proposisi

Predikat Kalkulus

5. Logic

Operator Simbol

AND ∩&,

OR ∪,+,V

NOT ¬,−

IMPLIES ,

EQUIVALENCE ≡

5 Logic (Operator)

Page 18: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

18

Merepresentasikan suatu statement yang memiliki nilai

kebenaran

Dalam logika prposisi suatu statemen dinyatakan secara

simbolik

5.1 Logika Proposisi

IF The car will not start A

AND It is too far to walk to work B

THEN I Will miss work today C

A B A and B

F F F

F T F

T F F

T T T

Assignment

- Silahkan Lakukan dengan

operator lain !

Disebut juga Logika Predikat (predicate logic)

Sebagai perluasan dari logika proposisi

Memungkinkan untuk melakukan representasikan suatu

proposisi dengan satu simbol

Simbol dalam predikat kalkulus bisa berupa

konstanta,predikat,variabel

Contoh

A = ball’s color is a red

Can be represent color(ball,red)

5.2 Predikat Kalkulus

Page 19: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

19

Masih Ingat Bahasa Prolog ?

5.2 Predikat Kalkulus- Prolog

ukuran(beruang,besar).

ukuran(gajah,besar).

ukuran(kucing,kecil).

ukuran(harimau,besar).

ukuran(singa, besar).

ukuran(kuda, besar).

warna(beruang,coklat).

warna(gajah,kelabu).

warna(kucing,hitam).

warna(kuda, coklat).

warna(singa,coklat).

warna(harimau,coklat).

gigi(gajah,tak_bertaring).

gigi(harimau,bertaring).

gigi(singa,bertaring).

gigi(kucing,bertaring).

gigi(beruang,bertaring).

gigi(kuda,tak_bertaring).

Buas (X) :- ukuran(X,besar),

warna(X,gelap),

gigi(X,bertaring).

Gelap(Y):-

warna(Y,hitam);

warna(Y,coklat).

Digunakan untuk merepresentasikan pengetahuan yang bersifat ambigu.

Pada fuzzy representation domain yang masih bersifat crisp harus diubah ke dalam

skala linguistik

Proses ini disebut sebagai fuzzifikasi

Proses fuzzifikasi menggunakan kurva keanggotaan seperti : Triangular, Trapezoidal,

Gaussiian, Bell, dll

6. Fuzzy Representation

Page 20: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

20

Temp: {Freezing, Cool, Warm, Hot}

Degree of Truth or "Membership"

50 70 90 1103010

Temp. (F°)

Freezing Cool Warm Hot

0

1

6. Fuzzy Representation

6.1 Degree of Membership

50 70 90 1103010

Temp. (F°)

Freezing Cool Warm Hot

0

1

Pertanyaan : Seberapa dinginkah suhu 36 F0

35 0F ?

Page 21: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

21

REFERENCES

Durkin, 1994. Expert System Design and Development. Prentice Hall International, Inc.

USA

Marimin.2002. Sistem Pakar Teori dan Aplikasinya dalam Teknologi Manajerial. IPB Press.

Indonesia

TUGAS KULIAH

Selesaikan pembentukan semantic Network masalah

ekosistem pada slide sebelumnya

Cari jurnal/prosiding internasional 5 tahun terakhir

mengenai sistem pakar dan lakukan critical review.

Maksimal 3 halaman

Tugas dikumpulkan dalam bentuk softcopy. Sertakan

jurnal/prosiding yang dikaji.

Dikumpulkan tanggal 28 Oktober 2015 melalui email

dalam format subject : Tugaskuliah_ES_NRP_.zip

Isi folder : docx, pfd (paper)

Kirim ke : [email protected]

Page 22: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

22

Jurnal Rujukan yang dilanggan IPB

• ACM digital library (www.dl.acm.org) Tidak perlu menggunakan username/password jika diakses melalui jaringan internet IPB • EBSCO (http://search.ebscohost.com/)

Username: ns180961 Password: password

• Infotrac (www.infotrac.galegroup.com/itweb) Username: ptn003 Password: success

• Sciencedirect (www.sciencedirect.com) Tidak perlu menggunakan username/password jika diakses melalui

jaringan internet IPB Username: jantisujana [untuk akses di luar kampus] Password: bogor57

• Proquest (http://search.proquest.com/) Username: 3FNP2CjRQQ Password: pqipb

SELESAI

TERIMA KASIH

Page 23: Representasi Pengetahuan - TOTO HARYANTO · 10/21/2015 2 Representasi Pengetahuan Knowledge is Power “Frasa ini akan menjadi kata kunci untuk menunjukkan bahwa knowledge sangat

10/21/2015

23

Bersemangatlah terhadap segala sesuatu yang

bermanfaat bagimu, mintalah pertolongn kepada Rabb

Mu dan Janganlah merasa lemah