Websites

Day 6

A*

1. create an empty list called "closedset"; this list will contain
states that have been visited
2. create a list called "openset" that contains just the starting
state; this list contains states that have not been visited but are
known to exist
2.a. create a list called "openset_states" that contains just the states
that would otherwise be in openset
3. create an empty map (key/value pairs) called "parents"; this map
contains the previous state of each state that has been visited
4. while the openset is not empty:
a. grab a state from the openset (and remove it from both sets);
put it in the closedset (since we're now looking at it)
- we need to prefer better states first
b. if that state is the goal, hey we're done!
i. return a reconstructed path from the goal state to the start
state (this is easy: recursively grab parent states from the
"parents" map)
c. it's not the goal state; for each next state that is accessible
from here:
i. if this next state is in the closedset (it has been visited
before), ignore it
ii. if this next state is not in the openset, put it in the
openset and record its parent
- if state not in openset_states:
d. (repeat the loop)
5. if the openset is empty and we never found the goal, oops!

In the news

Ant sorting

if not carrying anything, and at an object, decide stochastically
whether or not to pick it up

probability of picking it up decreases if this color has been seen
recently

p = (K+ / (K+ + F))^2

F is the fraction of items in memory of same color

K+ is a constant

if F becomes small compared to K+, p trends up (certainty)

if carrying something, drop according to:

p = (F / (K- + F))^2

if seen this color recently, more chance that you'll drop it

Prisoner's dilemma

if you screw over a nice person you win

you and your partner committed a crime

you are both arrested

the cops don't have much on you

if you defect (rat out your partner), AND your partner stays
silent, you get no jail time, partner gets 5 years

if you cooperate (stay silent), AND your partner cooperates, you
both get 1 year

if you both defect, you both get three years

what is your best option (if you don't communicate)

if you never see your partner again

always defect

Y

P

Y

P

D

D

-3

-3

D

C

0

-5

C

D

-5

0

C

C

-1

-1

Day 24

Machine learning

clustering: grouping data, without really having a clue what the
right groups are

classification: take a single data point and predict its class

why use clustering?

Wolfram Alpha, connect to facebook

marketing: get an idea of demographics, are there distinct groups
of consumers

exploratory analysis

why use classification?

facebook tags faces automatically

finding porn, and filtering it out

detect copyrighted videos

spam

separating email by promotions, social, etc.

xbox kinect detecting gameplay speaking vs. other speaking

and various motions

cheating analysis

with clustering, you don't have predefined groups (classes)

you also don't have the answers

with classification, you do

you also have some training set

K-means clustering

groups data into clusters

you have to decide k, i.e., how many clusters (decide a priori)

"closest" – Euclidean distance, Manhattan distance

each of these require that all dimensions are numeric

not all features are necessarily numeric

e.g., ethinicity, gender, country-of-residence, etc.

the centroids live in the feature space

must be able to generate new centroids as averages of points

algorithm:

randomly select k centroids

now loop:

for each point, determine the closest cluster

recompute centroids as averages of points for each cluster

repeat, until centroids don't change

k-means assumes clusters have "spherical" distributions

actually, the partition of the space is not spherical,
it's a Voronoi diagram

every possible point is closest to some cluster (or equidistant)

can ask about a new point, which cluster is it in?

Day 25

k-nearest neighbor is a way to do classification (not clustering)

scenario for classification:

you've got a lot of example points (with known classes)

you've got a new example, with an unknown class

what do you do?

figure out which point of which class is closest

according to, say, euclidean distance

or better, give each k closest points a "vote"

problems with large/small k:

if k is too small, noise has too great of an impact

if k is too large, the dominant class has too large of an
impact

k-nearest neighbor algorithm:

for new point X, find k closest known points

give each point a vote for that class

X gets class of most votes

variations:

weigh the vote by closeness: closer points get bigger vote

vote is worth 1/distance(p, X)

Classification evaluation

we have one dataset with known classes

let's split it into a training and testing set (say, 90/10%)

what are we interested in when we classify a set of points?

true positive (TP): the predicted class is the true class

false positive (FP): the predicted class is false

false negative (FN): failed to predict the true class

precision: tp/(tp+fp) – fraction of times it said "A class" and
got it right; in other words, fraction of responses about A class
that were correct

recall: tp/(tp+fn) – fraction of times it said "A class" over
number of things in A class; in other words, fraction of A class
things it correctly identified (recalled)

these measures come from information retrieval (e.g., search
engines)

imagine searching for "machine learning"

get high precision but lose on recall by doing:

it gives you just a couple good articles about ML, but misses
many

get high recall but lose on precision by doing:

give back the internet (surely it gets all the ML articles in
there)

so we have two metrics (precision/recall) that somewhat compete

it's a tradeoff

another metric: precision/recall

another metric: the arithmetic average

another metric: the harmonic average (F-score)

Day 26

Chinese room argument (Searle)

Weak AI

Can help test psychological theories

Not positing that the software is conscious or understands something

Strong AI

The program is a mind

It truly understands things

Is the psychological theory

Schank's scripts

Here's a story:

A man went into a restaurant and ordered a hamburger. When the
hamburger arrived it was burned to a crisp, and the man stormed out of
the restaurant angrily, without paying for the hamburger or leaving a
tip.

Did the man eat the hamburger? No

A man went into a restaurant and ordered a hamburger; when the
hamburger came he was very pleased with it; and as he left the
restaurant he gave the waitress a large tip before paying his bill."

Did the man eat the hamburger? Yes

Scripts

Are templates for stories; depending on the story, a certain template
is activated (e.g., the restaurant template), and can fill in missing
details.

If it answers correctly, consistently, we can say the software
understands what happened in the story.

Searle's counterargument

The setup

The assumption: Searle does not understand Chinese

Searle is stuck in a room

Three books:

Book 1: Chinese symbols

Book 2: Chinese symbols + English rules that utilize books 1 & 2

Book 3: Chinese symbols + English rules that utilize books 1 & 2

What happens?

Searle gets a message from the outside, in Chinese

He looks in books 1 & 2 & 3 and follows the English rules for
matching and correlating symbols, and spits out another Chinese
symbol

Clearly,

Searle is the computer

The English rules are the program

The books are the data

What if I told you that:

Searle was responding correctly, in Chinese, to Chinese questions
about Chinese stories?

Questions

Does Searle understand Chinese?

No

Does this program (the whole room) explain human understanding?

No, there is no understanding anywhere

What does Searle "have" in the case of English that he doesn't have
in the case of Chinese?

Possible replies

Brain simulator reply

The point

formal symbols and their manipulation will never produce
"understanding" or mental states

while on the other hand, when I think about "rain", I'm thinking
about rain, not the string "r a i n"

Robot ethics

Scenario: a self-driving car will hit a bus with children inside, or
it can swerve into traffic and hit a mother

What are the ethical issues, from a computational standpoint?

What is the right action?

How to compute it?

Who is responsible?

What are the ethical dimensions of an elevator?

Asimov's three laws

Robot cannot harm a human, or by inaction, allow a human to come to
harm.

Has to obey orders of a human, unless it violates first rule.

Robot shall preserve itself unless that violates rule 1 or 2.

Issues with Asimov's three laws

Are they computable?

No consideration of time

Curious question: Suppose you write a computer program for "ethical
questions", and then you ask it about abortion.

The harm may be "emergent" – e.g., telling a robot to forget what
it just did.