






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







based on material fromRay Mooney, DaphneKoller, Kevin Murphy
Agent/World Program
Learning Agent
Implements a function
State x Action -> RewardState x Action -> State’ Representation:
State – 8 bitsmay think of this as 8 binary features,4 features with 4 possible values, etc.
Action – 4 possible actions
Reward – integer range from -10…
State:
mood: happy, sad, mad, boredphysical: hungry, sleepypersonality: optimist, pessimist
Action:
smile, hit, tell-joke, tickle
State x Action -> Reward:
s x a -> 0
State x Action -> State
s x a -> bored = T, all others same as s
Example: Agent_with_Personality
State:
mood: happy, sad, mad, boredphysical: hungry, sleepypersonality: optimist, pessimist
Action:
smile, hit, tell-joke, tickle
State x Action -> Reward:
mood =? x physical <> sleepy, smile -> 5mood =? x physical <> sleepy, tell-joke -> 10 w/ prob. .8,
-10 w/ prob..
etc.
State x Action -> State
s x a -> mood = happy if reward is positives x a -> mood = mad if action is hit
etc.
Example: Robot Navigation
State:
location
Action:
forward, back, left, right
State x Action -> Reward:
define rewards of states in your grid
State x Action -> State
defined by movements
Learning Agent
Schedule
Thursday, Dec. 4In class, hand in a 1 page description of youragent, and some notes on your learningapproach Friday, Dec. 5Electronically submit your agent/worldprogram Thursday, Dec. 12Submit your learning agent
Naïve Bayes Assumption
=
)
d |
e
,...,
e ( P
i
m
1
what is the structure of the corresponding BN?
∏
m =
1
k
i
k
)
d |
e ( P
Naïve Bayes Example
possible diagnosis: Allergy, Cold and OK possible symptoms: Sneeze, Cough and Fever
P(fever|d)
P(cough|d)
P(sneeze|d)
P(d)
Allergy
Cold
Well
my symptoms are: sneeze & cough, what isthe diagnosis?
Learning the Probabilities
P(d
i ) – prior
P(e
k
|d
) – conditional probabilityi
Maximum Likelihood Estimate(MLE)
n N
d (
p
i
i
i ik
i
k
n n
d |
e (
p
where n
x
is shorthand for the counts of events in
training set
Example:
nonoyesnoyesnonononono Fever
no
yes
Allergy
no
yes
Allergy
no
no
Allergy
no
no
Well
no
no
Well
no
yes
Allergy
yes
yes
Cold
no
yes
Allergy
no
yes
Allergy
no
yes
Well
Cough
Sneeze
D
what is: P(Allergy)?P(Sneeze| Allergy)?P(Cough| Allergy)?
Laplace Estimate (smoothing)
n
n
d (
p
i
i
n
1 n ) d | e
p
ik i
i
k
where n is number of possible values for dand e is assumed to have 2 possible values
many other smoothing schemes…
Comments
Learning more complexBayesian networks
Formalization
we have a state space S we have a set of actions a1, …, ak we want to learn which action to take atevery state in the space At the end of a trial, we get some reward,positive or negative want the agent to learn how to behave in theenvironment, a mapping from states toactions
example: Alvinn
state: configuration of the car
learn a steering action for each state
Accessible or
observable state
Repeat:
Reactive Agent AlgorithmReactive Agent Algorithm
Policy^ Policy
(Reactive/Closed-(Reactive/Closed
-Loop Strategy)
Loop Strategy)
Π
is a complete mapping from states to actions
+1 -
3 2 1
4
3
2
1
Repeat:
Reactive Agent Algorithm^ Reactive Agent Algorithm
Approaches
Value Function
An agent knows what state it is in and it has anumber of actions it can perform in each state. Initially it doesn't know the value of any of thestates. If the outcome of performing an action at a state isdeterministic then the agent can update the utilityvalue U() of a state whenever it makes a transitionfrom one state to another (by taking what it believesto be the best possible action and thus maximizing): U(oldstate) = reward + U(newstate) The agent learns the utility values of states as itworks its way through the state space.
Exploration
The agent may occasionally choose to exploresuboptimal moves in the hopes of finding betteroutcomes. Only by visiting all the states frequentlyenough can we guarantee learning the true values ofall the states. A discount factor is often introduced to prevent utilityvalues from diverging and to promote the use ofshorter (more efficient) sequences of actions toattain rewards. The update equation using a discountfactor gamma is: U(oldstate) = reward + gamma * U(newstate) Normally gamma is set between 0 and 1.
Q-Learning
RL Summary
Genetic Algorithms
use evolution analogy to search for‘successful’ individuals individuals may be policy (like RL), acomputer program (in this case called geneticprogramming), a decision tree, a neural net,etc. success is measured in terms of
fitness
function. start with a pool of individuals and useselection and reproduction to evolve the pool
Basic Algorithm
1.
[Start]
Generate random population of
n individuals (suitable
solutions for the problem)
2.
[Fitness]
Evaluate the fitness
f(x) of each individual
3.
[New population]
Create a new population by repeating
following steps until the new population is complete
4.
[Selection]
Select two parents from a population according
to their fitness (the better fitness, the bigger chance to beselected)
5.
[Crossover]
With a crossover probability cross over the
parents to form a new offspring (children). If no crossoverwas performed, offspring is an exact copy of parents.
6.
[Mutation]
With a mutation probability mutate new
offspring at each locus (position in chromosome).
7.
[Accepting]
Place new offspring in a new population
8.
[Loop]
Go to step
2
GA Issues
GA summary
“neural networks are the second bestway of doing just about anything… andgenetic algorithms are the third”