# 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.

Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
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
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
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
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
hi
Loga
what does nano mean?
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
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! By Brooke Delaney By Sarah Warren By Sandhills MLT By OpenStax By OpenStax By OpenStax By Brooke Delaney By Cameron Casey By Jonathan Long By Anh Dao