INC 551 Artificial Intelligence

39
INC 551 Artificial Intelligence Lecture 7 Planning & Probability

description

INC 551 Artificial Intelligence. Lecture 7 Planning & Probability. Definition of Planning. Planning = The task of coming up with a sequence of actions That will achieve a goal. Planning of Logical Agent. World model = Proposition, First-order logic. - PowerPoint PPT Presentation

Transcript of INC 551 Artificial Intelligence

Page 1: INC 551  Artificial Intelligence

INC 551 Artificial Intelligence

Lecture 7

Planning &

Probability

Page 2: INC 551  Artificial Intelligence

Definition of Planning

Planning = The task of coming up with a sequence of actionsThat will achieve a goal

Page 3: INC 551  Artificial Intelligence

Planning of Logical Agent

World model = Proposition, First-order logic

จะใช้�วิ�ธี Search the world model ไม่�ได้�

Page 4: INC 551  Artificial Intelligence

Search the Logic Model

ม่แต่�irrelevantactions

ในแต่�ละที่�ที่�จะไปม่ที่างเล�อกม่ากเก�นไป

Page 5: INC 551  Artificial Intelligence

STRIPS OPERATOR

STRIPS = Stanford Research Institute Problem Solver

จะม่โครงส้�างของ action แต่�ละอ!นค�อ

Model ของAction ใน strip

Page 6: INC 551  Artificial Intelligence

Partial-Order Planning

เป"น algorithm search ที่�ไม่�ต่�องก#าหนด้วิ�าอะไรม่าก�อนม่าหล!งจะใช้�ก!บ precondition ของแต่�ละ action แบ�งเป"น 2 ข!&นต่อน

1 . ส้ร�าง graph เช้��อม่ระหวิ�าง precondition ต่�างๆ2. search ต่าม่แบบ depth-first จนหา goal เจอ โด้ยไม่�ห!กล�าง precondition อ!นอ��น

Page 7: INC 551  Artificial Intelligence

POP: Example

จะออกจากบ�านไปซื้�&อของค�อ drill, milk, bananaต่�องการส้ร�าง plan

Drill ขายที่� hardware storeMilk, banana ขายที่� supermarket

Page 8: INC 551  Artificial Intelligence
Page 9: INC 551  Artificial Intelligence

Plan Have(milk)ก!บ Have(drill)แยกก!น

Page 10: INC 551  Artificial Intelligence

Graph สมบู�รณ์�

Page 11: INC 551  Artificial Intelligence

Example: Block World

Page 12: INC 551  Artificial Intelligence
Page 13: INC 551  Artificial Intelligence
Page 14: INC 551  Artificial Intelligence
Page 15: INC 551  Artificial Intelligence
Page 16: INC 551  Artificial Intelligence

Clobber, Promotion, Demotion

Page 17: INC 551  Artificial Intelligence

Uncertainty

Page 18: INC 551  Artificial Intelligence

Uncertainty

• Propositional logic

• First-order logic

True – false - unknown

Page 19: INC 551  Artificial Intelligence

Different Types of Logics

เพราะในโลกม่!กม่ส้��งที่�ไม่�แน�นอน

Page 20: INC 551  Artificial Intelligence

Knowledge Base

นอนต่กหม่อน -> เจ+บคอเจ+บคอ -> เป"นโรคไอ

Query

ถ้�าม่คนไข�ม่าบอกวิ�าเจ+บคอForward chaining บอกวิ�า เขาเป"นโรคไอBackward chaining บอกวิ�า เขานอนต่กหม่อนม่า

จะพบวิ�าไม่�เก�ยวิก!นเพราะค#าพ-ด้ที่!�วิไปจะก#ากวิม่ในต่!วิม่!นเอง

Page 21: INC 551  Artificial Intelligence

ผู้-�ป/วิยบอกอาการวิ�า “เจ+บคอ”

Believe ต่กหม่อน 50%ไอ 50%ขาห!ก 0%

ผู้-�ป/วิยบอกอาการต่�อไปอกวิ�า “ม่ไข�”

Believe ต่กหม่อน 20%ไอ 80%ขาห!ก 0%

Page 22: INC 551  Artificial Intelligence

Proposition Logic

A B AvB A^B ~A

Probabilityจะใส้� P() คล0ม่เที่อม่พวิกน&แที่นควิาม่เช้��อ

P(A) P(B) P(AvB) P(A^B) P(~A)

ควิาม่เช้��ออย-�ในช้�วิง 0-1

Page 23: INC 551  Artificial Intelligence

Counting & Probability

Sample space = เหต่0การณ์2ที่�เป"นไปได้�ที่!&งหม่ด้เช้�นที่อด้ล-กเต่3า จะได้�แต่�ม่ {1,2,3,4,5,6}

Proposition = ควิาม่จร�ง true or false

ProbabilityP(1)=P(2)=P(3)=P(4)=P(5)=P(6)=1/6

Event ค�อเหต่0การณ์2จาก sample spaceP(dice roll<4) = 1/6 + 1/6 + 1/6

Page 24: INC 551  Artificial Intelligence

Random Variable

ค�อ ต่!วิแปรที่�ม่ค�าแปรผู้!นต่าม่ควิาม่น�าจะเป"นที่�ก#าหนด้จะเป"นได้�ที่!&ง continuous and discrete

Page 25: INC 551  Artificial Intelligence

Discrete Random Variable

เช้�น x = ค�าของล-กเต่3า

P(x = 3) = 1/6P(x < 3) = 1/6 + 1/6

1 2 3 4 5 6

1/6

P(x)

x

x ค�อ random variable

Page 26: INC 551  Artificial Intelligence

Continuous Random Variable

x

P(x)

P(-1<x<1) = 0.66P(x=0) = 0

Page 27: INC 551  Artificial Intelligence

Conditional Probability

หม่ายถ้4งถ้�าร-�วิ�า toothache แล�วิ (ร-�อย�างเด้ยวิ) จะม่ probability =0.8 ที่�เป"น cavity

Probability แบบม่เง��อนไข

Page 28: INC 551  Artificial Intelligence

หร�อ

Page 29: INC 551  Artificial Intelligence

Example

หม่อฟั6นต่�องการต่รวิจคนไข�วิ�าฟั6นผู้0หร�อไม่� (Cavity)จะใช้�การด้-อาการ 2 อย�าง1 . อาการปวิด้ฟั6น (Toothache)2. ต่รวิจด้�วิยเคร��องม่�อแพที่ย2วิ�าม่ร-ที่�ฟั6น (Catch)

โรค (Cause) = Cavityอาการ (Effect) = Toothache, Catch

Page 30: INC 551  Artificial Intelligence

Example

ม่ proposition 3 อย�าง toothache, cavity, catch

P(toothache) = ??

Page 31: INC 551  Artificial Intelligence

Inference by Enumeration

Page 32: INC 551  Artificial Intelligence
Page 33: INC 551  Artificial Intelligence
Page 34: INC 551  Artificial Intelligence

Independence

Page 35: INC 551  Artificial Intelligence

Bayes’ Rule

Page 36: INC 551  Artificial Intelligence

เรยก Naïve Bayes’ model

)(

)()|()|(

)(

)()|(

)|(

catchtoothacheP

cavityPcavitycatchPcavitytoothacheP

catchtoothacheP

cavityPcavitycatchtoothacheP

catchtoothachecavityP

Page 37: INC 551  Artificial Intelligence

Naïve Bayes’ model

ส้าเหต่0ม่าจากการหา conditional probability

น!&นจะที่#าได้�ยากถ้�าม่ effect หลายช้น�ด้เพราะ effect จะDependent ก!น

ด้!งน!&น Naïve Bayes’ บอกวิ�าให�ส้ม่ม่ต่�วิ�าม่!น independentก!นเพ��อควิาม่ง�าย ด้!งน!&น probability จ4งม่าค-ณ์ก!นได้�เลย

)|( CauseEffectP ALL

)|(

)|()|()|(

3

21

CauseEffectP

CauseEffectPCauseEffectPCauseEffectP ALL

Page 38: INC 551  Artificial Intelligence

Wumpus World

P(pit) = 0.2

Page 39: INC 551  Artificial Intelligence

16.004.016.016.004.0

)16.016.004.0(2.0

)(

)()()|( 3,13,1

3,1

BP

PBPPPBPP

ต่�องการที่ราบควิาม่น�าจะเป"นที่�ต่#าแหน�ง (1,3) จะม่หล0ม่