Download it can think - NUS School of Computing

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Pattern recognition wikipedia , lookup

AI winter wikipedia , lookup

Embodied cognitive science wikipedia , lookup

Technological singularity wikipedia , lookup

Computer Go wikipedia , lookup

Artificial intelligence in video games wikipedia , lookup

Ethics of artificial intelligence wikipedia , lookup

Intelligence explosion wikipedia , lookup

Philosophy of artificial intelligence wikipedia , lookup

History of artificial intelligence wikipedia , lookup

Existential risk from artificial general intelligence wikipedia , lookup

Transcript
Artificial Intelligence
Lee Wee Sun
School of Computing
[email protected]
Imitation Game
• A man and a woman are in
a separate room from us.
• Communicate using chat:
only text, without video or
voice.
• The man pretends to be the
woman.
• The woman tries to
convince us she really is a
woman!
• Figure out who is for real.
Artificial Intelligence
Can Machines Think?
Alan Turing (1950):
The question is meaningless.
• Let the machine play the
role of the man in the
imitation game.
• If it does as well as the
man, it can think!
Artificial Intelligence
Scientific Method
• Turing’s proposal converted the question of
whether machines can think into an empirical
question.
• Can apply the scientific method to the
question:
– Propose hypothesis
– Design experiment
– Gather data and analyze data
Artificial Intelligence
• Note the clever design of the experiment
– Use of instant messaging prevents irrelevant
factors such as appearance, voice, motion from
confounding the result
– Randomized design where the participants do not
know which candidate is woman and which is
machine
• What’s wrong with an experiment where we know which
candidate is the machine and are asked whether the
machine behaves like the woman?
Artificial Intelligence
Contrary Arguments
• AI will never be possible because …
• Theological Objection
– Thinking is a function of the soul and God has given souls
only to humans
– Response: God can confer souls to machines if He so
chooses; to forbid that would be to limit God’s power
• Head in the Sand Objection
– Let’s hope and believe machines cannot think; the
consequences are too dreadful
– Response: Not a logical argument. Consolation would be
more appropriate.
Artificial Intelligence
• Mathematical Objection
– Mathematical theorems such as Godel’s incompleteness
theorem show that there are some things that machines
cannot do
– Response: There are some things that humans cannot do as
well; does not prevent us from accepting that humans can
think
• Argument from Consciousness
– Machines can think only when it is able to feel its own
emotions and talk about its own thoughts
– Response: The only way to feel someone thinking is to be
that person. Too extreme, we accept that humans think from
their behaviour.
Artificial Intelligence
• Arguments from Various Disabilities
– A machine will never be able to do ….
– Various things suggested e.g. learn from
experience, make mistakes, etc.
– Mostly because people have never observed them
doing it
– Response: Today we’ll look at how machines can
be programmed to
• Play chess
• Learn
Artificial Intelligence
Applications
• Success at the level of
passing the Turing test has
so far been elusive.
• Success in more limited
domains are available
–
–
–
–
–
–
Chess playing programs
Expert systems
Web search
Speech recognition
Driving cars
…..
Artificial Intelligence
Chess
Play chess as well as a human being!
• Turing suggested that
intellectual activities
such as playing chess
may be a good place to
start.
• In 1997, Deep Blue
defeated World Chess
Champion Gary
Kasparov!
Artificial Intelligence
Computational
Thinking
• Computers are originally invented by Turing
as a model of human thinking
– Capable of solving extremely complex problems
• To deal with the complexity, computer
scientists have developed very powerful
computational thinking methods
– Should be learned by all as we are already in the
information age
– Do computing at university! :)
Artificial Intelligence
Reduction to Search
• Playing chess seems complicated
• Computational thinking suggests
transforming (reducing) it into
something that computers do well:
search
Artificial Intelligence
Inside a Game Engine
• Consider all the moves that you can make.
• Then all the moves that your opponent can
make.
• Repeating this generates a structure called
a search tree.
• Trees are upside down in computing, root
at the top, leaves at the bottom.
• Search the tree to find the winning move.
Artificial Intelligence
Minimax
• Perfect play for deterministic games
•
• Idea: choose move to position with highest minimax
value
= best achievable payoff against best play
•
• E.g., 2-ply game:
•
Artificial Intelligence
Evaluation Function
• Road Block!
• Searching to the end of
the game is practically
impossible because of
exponential growth!
• Search to a shallower
depth, use an evaluation
function to evaluate the
game positions.
• An evaluation
function gives an
estimated value to each
board position.
• According to legend, chess was
invented by an Indian
mathematician.
• The emperor was so pleased by
the game, he promised the
mathematician anything he
wanted.
• The mathematician asked for one
rice grain on the first square of
the chessboard, two on the
second, …, doubling each time.
• The emperor will have to
provide 460 billion tonnes,
6 times the Earth biomass
Player Strength
What determines the AI player strength?
• Knowledge encoded in
the evaluation function
– What is the board
position worth?
• Value of the queen,
bishop, knight, etc.
• Positions of the pieces
– Expert knowledge of the
game helpful
• Speed - how deep
can you search?
– Better algorithm
helps: α-β pruning
– Better hardware
helps
Artificial Intelligence
α-β Pruning
• More advance search method.
• Use knowledge of parts of tree already
searched to prune branches of the tree.
• Can usually search twice as deep for
games like chess!
Artificial Intelligence
α-β Pruning Example
Artificial Intelligence
α-β Pruning Example
Artificial Intelligence
α-β Pruning Example
Artificial Intelligence
α-β Pruning Example
Artificial Intelligence
α-β Pruning Example
Artificial Intelligence
Activity: Constructing
Evaluation Function
• You will construct evaluation functions
for Othello
• We will have a tournament to see
whose evaluation function works best!
Artificial Intelligence
Othello
• Rules of Othello
– Black moves first
– Can place piece if there is a
contagious line of opponent
pieces (horizontally, vertically
or diagonally) ended by your
own piece
– Flip opponent pieces
between your two pieces
after placement.
– Count pieces when no moves
available to either side
Artificial Intelligence
Othello Evaluation
• Corners and other positions
– Certain positions such as corners are highly
valued.
• Mobility and potential mobility
– Force your opponent to have fewer legal moves
(or potentially fewer moves in future): forces bad
moves from opponent.
• Stability
– Some positions can no longer be flipped (such as
corners), so are valued higher.
Artificial Intelligence
Construction
• Value function viewed from black’s view,
positive value good for black
• Two types of patterns
– Static
– Dynamic
• Each pattern returns the number of matches
for black minus the number of matches for
white on the board
• Evaluation function made up of sum of
weighted patterns.
Artificial Intelligence
Static Patterns
• Gives a score of the number
Example
of black minus the number
static
of white in the specified
pattern
squares.
Pattern
Score = 1
Pattern
Score = 1
Pattern
Score = 0
Artificial Intelligence
Dynamic Patterns
• Dynamic patterns are placed at every
position on the board.
Example 1 by 1 • Number of positions where dynamic
pattern matches exactly are added up
dynamic pattern
(black pattern matches).
that will
count the number • Corresponding dynamic pattern with
black replaced by white is automatically
of black pieces
generated and matched as well (white
minus the number pattern matches).
of white pieces
• Pattern score is the difference between
on the board.
black pattern matches and white
pattern matches.
• Dynamic patterns can match
larger patterns than a single
square.
• Patterns can be composed of 4
types of squares matching:
8 by 8 dynamic pattern
that matches exactly
when first column has
black at the top, white
at bottom and nothing
else in between.
–
–
–
–
Black
White
Empty
Don’t cares (matches everything)
Artificial Intelligence
Dynamic Pattern
Example
• The dynamic pattern
shown matches black
at 2 positions
• The pattern also
matches white at 1
position
• Score of the pattern is
2-1 = 1.
Artificial Intelligence
Example
Dynamic Pattern • DP1 counts the difference
DP1
between black and white
pieces, scoring -40
Static
Pattern SP2 • SP2 counts the number of
black corners minus the
number of white corners,
scoring 2
• If DP1 is weighted 1 and SP2
weighted 100, the total
score is -40+200=160.
Artificial Intelligence
Tournament
• Start constructing the evaluation
function!
• Use the test examples to guide your
construction.
• If you have time, you can play your
evaluation function against the built-in
evaluation functions.
• We will have a tournament at the end.
Artificial Intelligence
Summary (Games)
• Playing intellectual board games seems complex
but can be reduced to a simple computer search
problem (computational thinking)
• Problem is too difficult to search completely, so
knowledge (evaluation function) is also important.
• Can we extend to other types of computer games,
such as real time strategy games?
– See NUS team’s performance in international RTS game
AI tournament
• Tactical combat video
• Strategic combat video
Artificial Intelligence
Learning Machines
• Learning has always been an
important part of artificial
intelligence.
• Alan Turing suggested the use of
machine learning to build a
machine that can pass the Turing
test.
• Lots of practical applications.
Artificial Intelligence
Learning to Fly
Video source: Andrew Ng, Stanford University
Artificial Intelligence
Wired Magazine’s #1
robot of all time
Stanley, winner of the US$2millon DARPA Grand
Challenge
• Drove autonomously through 130
miles of dessert roads.
• Key technology: Adaptive vision
– Learn from human drivers before
race.
– Learn from experience during race.
Artificial Intelligence
Netflix Prize
• Largest online DVD rental
service
• Given your ratings for
some movies, predict the
your ratings of other
movies.
• US$1million prize for
system that improve
Netflix’s current system
by 10%.
Artificial Intelligence
Computer Vision
• Vision problems such as
face detection, face
recognition.
• Over 85% of
handwritten mail in US
automatically sorted by
software trained using
machine learning
Artificial Intelligence
Google Image
• NUS without face
detection
• NUS with face detection
(add &imgtype=face
to url)
Speech, Natural
Language
• Almost all speech recognition
systems use some form of
machine learning
• Text and natural language
processing applications e.g. spam
filtering
Machine learning methods give the best
performance on the types of practical problems
that we have shown. Why?
Artificial Intelligence
Fundamental
Questions
• How do we build computers that learn
from experience?
• What are the laws that govern learning
processes?
Artificial Intelligence
How to Learn?
• Assume that you have
one million computer
programs and you
know that one of them
can recognize
handwritten digits.
• How would you go
about constructing a
handwritten digit
classifier?
Artificial Intelligence
Computational
Thinking
• Computational
Thinking: reduce it to a
search problem!
• Simple approach:
– Collect lots of
handwritten digit
– Go through the one
million programs and
select the one that
performed the best on
the collected digits.
Artificial Intelligence
Learning as Search
• The example illustrates that we are interested
in searching for a computer program that
predicts well.
• Most learning algorithms work as follows:
– Define a class of models (programs)
– Obtain some examples.
– Search for a model that works well on the
examples.
Artificial Intelligence
Principle of Induction
• Search is not enough for learning.
• Need another basic scientific principle used for
doing induction.
– In induction (as opposed to deduction), scientists
develop theories based on observations.
– After seeing 1000 white swans, the scientist may
propose that all swans are white.
• What is the principle that allows induction to
be successful?
Artificial Intelligence
• Try to predict the next symbol in the
sequence below.
2 4 6 8 10 12
• A more difficult problem
1 1 2 3 5
8
• So what is the principle for successful
induction?
• Try another problem
0 0 1 1 0 1 1 0 1 1 0
Artificial Intelligence
• Sequence generator remembers
Current
Next
current and previous symbol and
Subseq Symbol
use the table to generate the next
symbol
00
1
• For each current subsequence
01
1
need to learn the next symbol
10
1
• Current subsequence of length 1,
2, 3, … has table sizes 2, 4, 8, …
11
0
etc
• Larger tables are more complex:
more to learn before good
prediction possible
0 0 1 1 0 1 1 0 1 1 0
Occam’s Razor
•
•
•
The guiding principle in scientific induction is to use the simplest theory
that explains the observations adequately.
Machine learning is induction done by machines!
Computational problem modified to finding a program that minimizes
sum of training error and measure of complexity
Error
Training error
Test error
Complexity
Artificial Intelligence
Summary (Learning)
• Learning can be reduced to search
(computational thinking) - search for a
function that works well on data we
have seen before
• Need additional principle for successful
induction: Occam’s Razor, use the
simplest explanation (function) that
works well.
Artificial Intelligence
Summary (AI)
• Computing is about extending human
abilities.
• Just like cars and planes extend our physical
abilities, computers extend our mental
abilities, allowing us to automate many things
that previously need to be done manually.
• Early days in AI still.
• Lots of interesting work to come!
Artificial Intelligence
Summary
(Computational Thinking)
• As computers help us solve very complex problems,
computer scientists have developed methods for
understanding and solving complex problems:
computational thinking
• We have seen two examples of application of a
particular computational thinking paradigm to AI
problems- reduction to search
– Both games and learning can be reduced to search problems
• Many others: abstraction, divide and conquer, use of
invariants, etc.
• Computational thinking is becoming essential
knowledge in the information age
• Interested? Do a computing degree. :)
To find out more
about computing …
• Do a project at the School of Computing
• Join your school’s computing club
• Participate in the National Infocomm
Competition
–
–
–
–
–
Programming competition
Quizzes
Game programming
Lego competition
Etc.
Artificial Intelligence
Acknowledgements
• Some of the material and slides are
taken from
– Artificial Intelligence: A Modern Approach
(Second Edition) by Stuart Russell and
Peter Norvig
http://aima.eecs.berkeley.edu/
Artificial Intelligence