# 2.12 Machine learning lecture 12 course notes  (Page 8/8)

 Page 8 / 8

In detail, the algorithm is as follows:

1. Randomly sample $m$ states ${s}^{\left(1\right)},{s}^{\left(2\right)},...{s}^{\left(m\right)}\in S$ .
2. Initialize $\theta :=0$ .
3. Repeat $\left\{$
1. For $i=1,...,m$ $\left\{$
1. For each action $a\in A$ $\left\{$
1. Sample ${s}_{1}^{\text{'}},...,{s}_{k}^{\text{'}}\sim {P}_{{s}^{\left(i\right)}a}$ (using a model of the MDP).
2. Set $q\left(a\right)=\frac{1}{k}{\sum }_{j=1}^{k}R\left({s}^{\left(i\right)}\right)+\gamma V\left({s}_{j}^{\text{'}}\right)$
3. $\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}//$ Hence, $q\left(a\right)$ is an estimate of $R\left({s}^{\left(i\right)}\right)+\gamma {\mathrm{E}}_{{s}^{\text{'}}\sim {P}_{{s}^{\left(i\right)}a}}\left[V\left({s}^{\text{'}}\right)\right]$ .
2. $\right\}$
3. Set ${y}^{\left(i\right)}={max}_{a}q\left(a\right)$ .
4. $\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}//$ Hence, ${y}^{\left(i\right)}$ is an estimate of $R\left({s}^{\left(i\right)}\right)+\gamma {max}_{a}{\mathrm{E}}_{{s}^{\text{'}}\sim {P}_{{s}^{\left(i\right)}a}}\left[V\left({s}^{\text{'}}\right)\right]$ .
2. $\right\}$
3. $//$ In the original value iteration algorithm (over discrete states)
4. $//$ we updated the value function according to $V\left({s}^{\left(i\right)}\right):={y}^{\left(i\right)}$ .
5. $//$ In this algorithm, we want $V\left({s}^{\left(i\right)}\right)\approx {y}^{\left(i\right)}$ , which we'll achieve
6. $//$ using supervised learning (linear regression).
7. Set $\theta :=arg{min}_{\theta }\frac{1}{2}{\sum }_{i=1}^{m}{\left({\theta }^{T},\phi ,\left({s}^{\left(i\right)}\right),-,{y}^{\left(i\right)}\right)}^{2}$
4. $\right\}$

Above, we had written out fitted value iteration using linear regression as the algorithm to try to make $V\left({s}^{\left(i\right)}\right)$ close to ${y}^{\left(i\right)}$ . That step of the algorithm is completely analogous to a standard supervised learning (regression) problem in which we have a training set $\left({x}^{\left(1\right)},{y}^{\left(1\right)}\right),\left({x}^{\left(2\right)},{y}^{\left(2\right)}\right),...,\left({x}^{\left(m\right)},{y}^{\left(m\right)}\right)$ , and want to learn a function mapping from $x$ to $y$ ; the only difference is that here $s$ plays the role of $x$ . Eventhough our description above used linear regression, clearly other regression algorithms (such as locally weighted linear regression) can also be used.

Unlike value iteration over a discrete set of states, fitted value iteration cannot be proved to always to converge. However, in practice, it often does converge (or approximately converge), and works well for many problems.Note also that if we are using a deterministic simulator/model of the MDP, then fitted value iteration can be simplified by setting $k=1$ in the algorithm. This is because the expectation in Equation  [link] becomes an expectation over a deterministic distribution, and so a single example is sufficient to exactly compute that expectation.Otherwise, in the algorithm above, we had to draw $k$ samples, and average to try to approximate that expectation (see the definition of $q\left(a\right)$ , in the algorithm pseudo-code).

Finally, fitted value iteration outputs $V$ , which is an approximation to ${V}^{*}$ . This implicitly defines our policy. Specifically,when our system is in some state $s$ , and we need to choose an action, we would like to choose the action

$arg\underset{a}{max}{\mathrm{E}}_{{s}^{\text{'}}\sim {P}_{sa}}\left[V\left({s}^{\text{'}}\right)\right]$

The process for computing/approximating this is similar to the inner-loop of fitted value iteration, where for each action, we sample ${s}_{1}^{\text{'}},...,{s}_{k}^{\text{'}}\sim {P}_{sa}$ to approximate the expectation. (And again, if the simulator is deterministic, we can set $k=1$ .)

In practice, there're often other ways to approximate this step as well. For example, one very common case is if thesimulator is of the form ${s}_{t+1}=f\left({s}_{t},{a}_{t}\right)+{ϵ}_{t}$ , where $f$ is some determinstic function of the states (such as $f\left({s}_{t},{a}_{t}\right)=A{s}_{t}+B{a}_{t}$ ), and $ϵ$ is zero-mean Gaussian noise. In this case, we can pick the action given by

$arg\underset{a}{max}V\left(f\left(s,a\right)\right).$

In other words, here we are just setting ${ϵ}_{t}=0$ (i.e., ignoring the noise in the simulator), and setting $k=1$ . Equivalently, this can be derived from Equation  [link] using the approximation

$\begin{array}{ccc}\hfill {\mathrm{E}}_{{s}^{\text{'}}}\left[V\left({s}^{\text{'}}\right)\right]& \approx & V\left({\mathrm{E}}_{{s}^{\text{'}}}\left[{s}^{\text{'}}\right]\right)\hfill \\ & =& V\left(f\left(s,a\right)\right),\hfill \end{array}$

where here the expection is over the random ${s}^{\text{'}}\sim {P}_{sa}$ . So long as the noise terms ${ϵ}_{t}$ are small, this will usually be a reasonable approximation.

However, for problems that don't lend themselves to such approximations, having to sample $k|A|$ states using the model, in order to approximate the expectation above, can be computationally expensive.

how can chip be made from sand
are nano particles real
yeah
Joseph
Hello, if I study Physics teacher in bachelor, can I study Nanotechnology in master?
no can't
Lohitha
where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
has a lot of application modern world
Kamaluddeen
yes
narayan
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
how did you get the value of 2000N.What calculations are needed to arrive at it
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!

#### Get Jobilize Job Search Mobile App in your pocket Now! By Vongkol HENG By Brenna Fike By Angela January By Royalle Moore By Richley Crapo By Rachel Woolard By John Gabrieli By Brooke Delaney By Madison Christian By IES Portal