35
CS 170 CS 170 INTRO TO ARTIFICIAL INTRO TO ARTIFICIAL INTELLIGENCE INTELLIGENCE Dr Eamonn Keogh [email protected] http://www.cs.ucr.edu/~eamonn/ Office: 323 Surge Time: 12:40pm-2pm Tuesday/Thursday in SPR 2355 Today (and today only) we will start 5 minutes late to allow stragglers find the classroom. (if you need a copy of the textbook, I can put you in touch with someone who wants to sell her brand new book at half price, stop by my office after class)

CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh [email protected] eamonn/ Office:

Embed Size (px)

Citation preview

Page 1: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

CS 170 CS 170 INTRO TO ARTIFICIAL INTELLIGENCEINTRO TO ARTIFICIAL INTELLIGENCEDr Eamonn [email protected]://www.cs.ucr.edu/~eamonn/Office: 323 Surge

Time: 12:40pm-2pm Tuesday/Thursday in SPR 2355

Today (and today only) we will start 5 minutes late to allow stragglers find the classroom.(if you need a copy of the textbook, I can put you in touch with someone who wants to sell her brand new book at half price, stop by my office after class)

Page 2: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Before we begin to learn, the usual Before we begin to learn, the usual administration trivia…administration trivia…

• There is a class webpage! (Not official till Saturday at 5:00)• Virtually all notes/overheads/homeworks are already online.• Note that there is a small chance that I might change/add to the material, so you should always make sure that you have the latest version. • I recommend that you print out the slides (six to a page) before attending lecture.

• You are obliged to visit the webpage twice a week to check for announcements, you are 100% responsible for any announcements made.

Page 3: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

GradingGrading Midterm Exam: ~ 25%  Final Exam: ~ 25%  Homework Assignments: ~ 10%  Programming Assignments: ~ 30% • Participation / pop quizzes: ~ 10%

I may give pop quizzes at the beginning of class. If you are more than one second late, you will not be allowed to take the quiz. You cannot “make up” missed quizzes. To get participation credit you can… ask meaningful questions in class, point out errors in my slides and handouts, email me with pointers to interesting websites (that refer to topics discussed in class)… Homework is due on my desk in the first 15 seconds of the class on the date in question. After 15 seconds the homework is considered late. You will be penalized 5% for each day you are late.  For all homework and programming projects you are obliged to keep an electronic copy until at least one week after the final. If requested, you must email me a copy of the file(s) within 48 hours. Failure to produce the electronic copy will result (at least) in a grade of zero for the assignment in question.

Page 4: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Cheating PolicyCheating Policy

Students must read and understand UCR policy on academic honesty. http://www.cs.ucr.edu/curriculum/acad_honest.html

Note, I am very good at detecting cheating (I have taught classes on the subject). Anyone caught cheating will given a final grade of F and may have a letter placed in his or her permanent record. Students are expected to take care that others cannot “cheat off them”. For example, if leave your homework on a shared hard drive or an abandoned floppy and someone else hands it in, you are liable and will have your grade adjusted downward.

Page 5: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Classroom BehaviorClassroom BehaviorI do not want to hear your beepers/cell phones during class. First offence will result in the lowering of your final grade by one letter. Second offence will result in a failing grade and removal from class.

Sending or receiving text messages/email, or using the web while in class, will result a failing grade.

Chronic lateness (or leaving class early) is unacceptable (it is disrespectful and disruptive to the instructor and other students). If you are late once, forget about it. The second time you are late you should approach me after class to explain why (failing to do so may result in a 1-percentage point reduction in your grade).

Page 6: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Classroom AttendanceClassroom Attendance

Attendance is optional, you will not be penalized for not showing up for class. However, it is hard for me to imagine someone doing well in this class without regular attendance.

In addition, if you are regularly absent you should expect the lowest priority for office hours/ TA help and email replies. Finally, I may make announcements and or changes in class, you are responsible for knowing what you missed.

Page 7: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Office HoursOffice Hours

Office Hours are currently, Friday 10:00am to 12:00am

These hours will almost certainly change, check the webpage

Page 8: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Email/PhonesEmail/Phones I strongly prefer that you only email me from your official UCR email. If you must email me from another account (i.e. a hotmail or yahoo account) you must state your full name, the last 4 digits of your student ID, and your official UCR email address.

You must check your UCR email account at least twice week until one week after the finals. If I send you an email requesting clarification on some issue, and you do not respond within 4 days, I will give you zero credit for the material in question.

Think before emailing myself or a TA.

· I don’t like to use phones, never call me unless it is a true emergency.

Page 9: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

What is AI?What is AI?

“A Steven Spielberg movie that really sucked”Eamonn Keogh

“The capacity of a digital computer to perform tasks commonly associated with the higher intellectual processes characteristic of humans, such as the ability to reason, discover meaning, generalize, or learn from past experience.”

Encyclopaedia Britannica.

AI is trying to solve by computer any problem that a human can solve faster/better.

“FOLDOC”

Page 10: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Why study AI? Part IWhy study AI? Part I

• Computers with intelligence would have a huge impact on civilization.• Unlike faster than light travel or anti gravity devices, there is strong evidence that AI is possible.• AI (along with genetics) is most often cited as “the field I would most like to be in” by researchers in other fields.• Personal motivation. The last big mystery?

Page 11: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Why study AI? Part IIWhy study AI? Part II

Some people who study AI are only interested in solving problems. Others reason like this… “I want to study humans, since the most interesting feature of humans is their intelligence, I will study artificial intelligence to understand true intelligence”.

This has always struck me as a weak argument. The very earliest attempts at flight tried to emulate birds by building flying machines that flapped their wings (ornithopters). Although manned aircraft can hover/carry enormous loads/fly

faster than sound, no manned ornithopter has ever flown.

Page 12: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

The plan for the quarter (subject to change)

•Three weeks studying search (exhaustive search, uninformed search, informed search, adversarial search).•Two weeks studying machine learning (nearest neighbor and decision trees classification (possibly neural networks) and clustering).•Three weeks studying logic systems (propositional logic, first order logic, resolution).• One week advanced topics (possible topics: genetic algorithms, bayesian networks, similarity, biometrics...).

Page 13: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Farmer, Wolf, Goat, Cabbage

Farmer, Fox, Chicken, Corn

Farmer Dog, Rabbit, Lettuce

The Farmer, Wolf, Duck, Corn ProblemThe Farmer, Wolf, Duck, Corn Problem

A farmer with his wolf, duck and bag of corn come to the east side of a river they wish to cross. There is a boat at the rivers edge, but of course only the farmer can row. The boat can only hold two things (including the rower) at any one time. If the wolf is ever left alone with the duck, the wolf will eat it. Similarly if the duck is ever left alone with the corn, the duck will eat it. How can the farmer get across the river so that all four arrive safely on the other side?

The Farmer, Wolf, Duck, Corm problem dates back to the eighth century and the writings of Alcuin, a poet, educator, cleric, and friend of Charlemagne.

Page 14: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

F W D C

F D CW

This means that everybody/everything is on the same side of the river.

This means that we somehow got the Wolf to the other side.

Page 15: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

F W D C

W D CF

D CF W

W CF D

W DF C

Illegal StateSearch Tree for “Farmer, Wolf, Duck, Corn”

Page 16: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

F W D C

W D CF

D CF W

W CF D

W DF C

F W CD

F W D C

Repeated StateIllegal StateSearch Tree for “Farmer, Wolf, Duck, Corn”

Page 17: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

F W D C

W D CF

D CF W

W CF D

W DF C

F W CD

F W D C

WF D C

F W CD

W CF D

CF W D

F CW D

F D CW

DF W C

F W DC

F WD C

F W CD

W DF C

WF D C

CF W D

D CF W

DF W C

F D CW

F W DC

F DW C

F W D CD

F W C

Goal StateRepeated StateIllegal StateSearch Tree for “Farmer, Wolf, Duck, Corn”

Page 18: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

F W D C

W CF D

F W CD

CF W D

F D CW

DF W C

F DW C

F W D C

F W D C

W CF D

F W CD

CF W D

F D CW

DF W C

F DW C

F W D C

Farmer returns alone

Farmer takes duck to left bank

Farmer takes wolf to left bank

Farmer returns with duck

Farmer takes corn to left bank

Farmer returns alone

Farmer takes duck to left bank

Success!

Initial State

Page 19: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

• Missionaries and Cannibals: (three of each, boat holds 2, if cannibals outnumber the missionaries they'll eat them).

• Jealous Husbands: three couples, boat holds 2 people at most, no wife can be left with any man unless her husband is also present.

• U2 has a concert that starts in 17 minutes and they must all cross a bridge to get there. All four men begin on the same side of the bridge. You must help them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one

time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must

be walked back and forth, it cannot be thrown, etc. Each band member walks at a different speed. A pair must walk together at the rate of the slower man's pace. Bono takes 1 minute to cross, the Edge takes 2 minutes to cross, Adam takes 5 minutes to cross, and Larry takes 10 minutes to cross. How can they accomplish the crossing in the allotted time?

It is no surprise to learn that the technique used to solve Farmer, Wolf, Duck, Corn can be used to solve other similar problems...

What is surprising, is that search can be used to solve an amazing number of important problems that don’t appear (at first glance) to be amiable to search...

Page 20: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

A farm hand was sent to a nearby pond to fetch 8 gallons of water. He was given two pails - one 11, the other 6 gallons. How can he measure the requested amount of

water?

Sliding Tile PuzzleYou can slide any of the numbered tiles into the blank space.Can you arrange the numbers into order?

Can you place 8 queens on a chessboard such that no piece is attacking another?

Find a route from LAX to the Golden Gate bridge that minimizes the driving time, ...that minimizes the mileage, ...that minimizes the number of Taco Bells

you must pass.

Which tree shows the correct relationship between gorilla, chimp and man?When you have just 3 animals, there are only three possible trees...

Species Number of trees3 310 34,459,425

Page 21: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

We have seen that the Farmer, Wolf, Duck, Corn can be easily solved using search. So why spend so much time on a trivial technique for solving problems?

Farmer, Wolf, Duck, Corn has a small search space!

However, many real world problems have very large (possibly infinite) search spaces. How do we search a space that has more states than there are electrons in the universe?

Also Farmer, Wolf, Duck, Corn assumes we have perfect knowledge (we always know where everything is) and a static world (the river is not changing, the boat is always the same etc).

However, in many real world problems we do not have perfect knowledge of the current state of the world, furthermore the world is changing in ways we cannot predict or control.

Page 22: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

That was search…That was search…

Now lets preview Now lets preview Machine Learning….Machine Learning….

Page 23: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Examples of class A Examples of class B 1) What class is this object?

2) What class is this object?

1

2

3

4

1

2

3

4

Page 24: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Examples of class A Examples of class B

1

2

3

4

1

2

3

4

3 4

1.5 5

6 8

2.5 5

5 2.5

5 2

8 3

4.5 3

1) What class is this object?

2) What class is this object?

8 1.5

4.5 7

Page 25: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Examples of class A Examples of class B 1) What class is this object?

2) What class is this object?

1

2

3

4

1

2

3

4

Page 26: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Examples of class A Examples of class B 1) What class is this object?

2) What class is this object?

1

2

3

4

1

2

3

4

Page 27: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

The “game” we have just been playing is Supervised Classification, a sub-field of Machine Learning, which is itself a sub-field of artificial intelligence.

Why is it useful?

Page 28: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Examples of class APeople who contracted

disease X.

Examples of class BPeople who are disease free.

1) What class is this person?Is this person at risk of getting the disease?

2) What class is this person?Is this person at risk of getting the disease?

1

2

3

4

1

2

3

4

Patient temperature 99Blood count 4214Weight 167

Patient temperature 98Blood count 3214Weight 179

Patient temperature 97Blood count 2763Weight 121

Patient temperature 99Blood count 3234Weight 117

Patient temperature 97Blood count 0012Weight 190

Patient temperature 99Blood count 0114Weight 202

Patient temperature 98Blood count 1014Weight 345

Patient temperature 99Blood count 1214Weight 190

Patient temperature 97Blood count 0118Weight 280

Patient temperature 99Blood count 3452Weight 99

Page 29: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Machine Learning can be used to learn…

• Who might die of a certain disease• Which people are likely to default of their credit card loan.• Which new movies you might enjoy.• Whether or not this X-ray of a suitcase shows a bomb.• Which webpages contain pornography.• What are the likely side effects of this new drug.• The best way to route an email.• The most efficient settings for your car’s fuel injector.• Etc etc

Page 30: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Why is Machine Learning a hard problem?

• There might be missing/noisy features.• There might be irrelevant features.• The features may be related. • It might be hard to create a good representation of the data• We might “overfit” when learning.• We might have problems with time/space complexity.

Examples of class APeople who contracted

disease X.

Patients name: Dave HoPatient temperature 103Blood count: unknownWeight 407

Patients name: Dave SmithPatient temperature 102Blood count: 3214Weight 445

Page 31: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

That was Machine Learning …

Now lets preview Knowledge Representation

Page 32: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Knowledge Representation I Suppose I tell you that…

•Bob weighs 12 pounds•Bob likes to chase mice•Bob is afraid of dogs

…if someone asked you “What is Bob”, what would you say?

Page 33: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

Knowledge Representation II This ability of humans (and to a lesser extent other animals) to be able to take a set of facts and a set of rules for manipulating facts, then to come up with new facts is at the heart of intelligence.

This is true at a high level…

• Given a set of facts about physics and math, Einstein was able to come up with a new fact, E = MC2

…and a low level

• Given a set of facts* about the Accounting Assistant in the CS department, I was able to come up with the fact that she is married.

* She wears a ring on her left “ring”finger. Her business card has a last name scratched out and a new name penciled in.

Page 34: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

How do we know if we

have succeeded?

The Turing Test

Alan Turing1912-54

?

Page 35: CS 170 INTRO TO ARTIFICIAL INTELLIGENCE CS 170 INTRO TO ARTIFICIAL INTELLIGENCE Dr Eamonn Keogh eamonn@cs.uci.edu eamonn/ Office:

JUDGE11 DO YOU BELIEVE IN GODPROGRAM? Of course I believe in God, Judge11.JUDGE11 WHAT DO YOU BELIEVE ABOUT HIMPROGRAM? I believe in the Bible.JUDGE11 DO YOU ATTEND CHURCHPROGRAM? No I do not attend church. Do you? I am always on the Web.

….

JUDGE01 What on earth do you mean?PROGRAM? Wow! You are interested in astronomy!

….

JUDGE11 HOW IS THE FATHER OF ANDY S MOTHER RELATED TO ANDY PROGRAM? Fine as far as I know.

Transcripts from the Loebner 2000 Prize