Docsity

Bayesian Networks and Machine Learning: Project Overview, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
1
Learning 3:
Bayesian Networks
Reinforcement Learning
Genetic Algorithms
based on material from
Ray Mooney, Daphne
Koller, Kevin Murphy
Project
Teams: 2-3
Two components:
Agent/World Program
Learning Agent
Agent/World Program
Implements a function
State x Action -> Reward
State x Action -> State’
Representation:
State – 8 bits
may think of this as 8 binary features,
4 features with 4 possible values, etc.
Action – 4 possible actions
Reward – integer range from -10…10
Example: Boring_Agent
State:
mood: happy, sad, mad, bored
physical: hungry, sleepy
personality: 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
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Bayesian Networks and Machine Learning: Project Overview and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Learning 3:

Bayesian NetworksReinforcement LearningGenetic Algorithms

based on material fromRay Mooney, DaphneKoller, Kevin Murphy

Project

Teams: 2-3 Two components:

„

Agent/World Program

„

Learning Agent

Agent/World Program

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…

Example: Boring_Agent

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

Calls Agent Program to get a trainingset Learns a function Calls Agent Program to get anevaluation set Computes Optimal set of actions Calls Agent Program to evaluate the setof actions

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

Assume each piece of evidence(symptom) is independent give thediagnosis

then

=

)

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

aka parameter estimation we need

„

P(d

i ) – prior

„

P(e

k

|d

) – conditional probabilityi

use training data to estimate

Maximum Likelihood Estimate(MLE)

use frequencies in training set toestimate:

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)

use smoothing to eliminate zeros:

n

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

Generally works well despite blanketassumption of independence Experiments show competitive withdecision trees on some well known testsets (UCI) handles noisy data

Learning more complexBayesian networks

Two subproblems: learning structure: combinatorial searchover space of networks learning parameters values: easy if allof the variables are observed in thetraining set; harder if there are ‘hiddenvariables’

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: Š

s

Å

sensed state

Š

If s is terminal then exit

Š

a

Å

choose action (given s)

Š

Perform a

Reactive Agent AlgorithmReactive Agent Algorithm

Policy^ Policy

(Reactive/Closed-(Reactive/Closed

-Loop Strategy)

Loop Strategy)

  • A policy

Π

is a complete mapping from states to actions

+1 -

3 2 1

4

3

2

1

Repeat: Š

s

Å

sensed state

Š

If s is terminal then exit

Š

a

Å

(s)

Š

Perform a

Reactive Agent Algorithm^ Reactive Agent Algorithm

Approaches

learn policy directly– function mappingfrom states to actions learn utility values for states, the valuefunction

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

augments value iteration by maintaininga utility value Q(s,a) for every action atevery state. utility of a state U(s) or Q(s) is simplythe maximum Q value over all thepossible actions at that state.

RL Summary

active area of research both in OR and AI several more sophisticated algorithmsthat we have not discussed applicable to game-playing, robotcontrollers, others

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

what is fitness function? how is an individual represented? how are individuals selected? how do individuals reproduce?

GA summary

easy to apply to a wide range ofproblems results good on some problems and notso hot on others

“neural networks are the second bestway of doing just about anything… andgenetic algorithms are the third”