<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Reinforcement Learning: An Introduction on Massimo Nocentini</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/</link><description>Recent content in Reinforcement Learning: An Introduction on Massimo Nocentini</description><generator>Hugo</generator><language>en-US</language><atom:link href="https://massimo-nocentini.github.io/book/reinforcement-learning/index.xml" rel="self" type="application/rss+xml"/><item><title>Preface</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/preface/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/preface/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Reinforcement learning is learning what to do&lt;/span&gt; — how to map situations to actions — so as to maximize a numerical reward signal, by an agent that is told nothing about which actions to take and must discover it by trying them.&lt;label for="sn-d0b9cd-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-d0b9cd-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; Richard Sutton and Andrew Barto’s &lt;em&gt;Reinforcement Learning: An Introduction&lt;/em&gt; is the book that defined the field: its first edition (1998) gave the subject its vocabulary, and its second edition (2018) rebuilt it around function approximation, off-policy learning and policy gradients, just as deep reinforcement learning was making the ideas famous.&lt;label for="sn-d0b9cd-2" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-d0b9cd-2" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton1998"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. MIT Press, Cambridge, MA, 1998&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Notation and Conventions</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/notation/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/notation/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;The notation is Sutton and Barto’s&lt;/span&gt; throughout, so that a reader can move between this companion and the original without translation.&lt;label for="sn-30d7bb-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-30d7bb-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; Capital letters are random variables and lower-case letters their values or scalar functions; vectors are bold lower case, even when random, and matrices bold capitals. The symbol &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo&gt;≐&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\doteq&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; marks an equality that holds by definition, and &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mo&gt;←&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\leftarrow&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; an assignment inside an algorithm.&lt;/p&gt;</description></item><item><title>The Reinforcement Learning Problem</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/01-introduction/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/01-introduction/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Nobody tells an infant&lt;/span&gt; which muscle to move. It moves anyway, and the world answers: a toy rattles, a hand reaches the mouth, the bottle comes or does not. Out of that stream of consequences it learns what to do. &lt;strong&gt;Reinforcement learning&lt;/strong&gt;&lt;span class="index-anchor" data-index="reinforcement learning"&gt;&lt;/span&gt; is the computational study of this kind of learning: an agent that acts, observes how good the outcome was, and adjusts its behavior so as to collect as much reward as possible over time.&lt;label for="sn-2c58f7-2" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-2c58f7-2" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; This chapter fixes the vocabulary of everything that follows, shows on a small game the first temporal-difference update, and sketches the three historical threads that produced the field. The formal machinery (Markov decision processes, Bellman equations) waits for &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/03-mdp/"&gt;Chapter&amp;nbsp;3&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Multi-armed Bandits</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/02-bandits/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/02-bandits/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Strip away states and delayed consequences&lt;/span&gt;, and what remains of reinforcement learning is a single question asked over and over: which action is best, when the only way to find out is to try them and see what they pay? That is the &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;k&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;k&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-armed bandit problem. It isolates the feature that most distinguishes reinforcement learning from supervised learning, &lt;strong&gt;evaluative feedback&lt;/strong&gt;&lt;span class="index-anchor" data-index="evaluative feedback"&gt;&lt;/span&gt;: a reward says how good the chosen action was, not which action would have been best (see &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/01-introduction/#sec:intro-evaluative"&gt;Section&amp;nbsp;1.1.1&lt;/a&gt;). This chapter builds the estimators and the exploration rules that later chapters reuse everywhere: sample averages and their incremental form, constant step sizes and the bias–variance trade-off they imply, optimistic initial values, upper confidence bounds, and gradient ascent on action preferences, which is the first policy-gradient method of the book. A final section goes beyond Sutton and Barto to the theory of &lt;em&gt;regret&lt;/em&gt; and optimal exploration.&lt;/p&gt;</description></item><item><title>Finite Markov Decision Processes</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/03-mdp/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/03-mdp/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;A bandit has one situation&lt;/span&gt; and many actions; the problems Sutton and Barto study have many situations, and the action taken in one of them decides which ones come next. The &lt;strong&gt;Markov decision process&lt;/strong&gt; (MDP) is the mathematical form of that problem: rewards are still evaluative, as in &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/02-bandits/"&gt;Chapter&amp;nbsp;2&lt;/a&gt;, but they are now &lt;em&gt;delayed&lt;/em&gt;, because an action changes the state and therefore every reward that follows.&lt;label for="sn-967ac4-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-967ac4-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; This chapter sets up the objects that every later chapter manipulates — dynamics, returns, policies, value functions — and derives the two families of equations that tie them together: the Bellman equations for a fixed policy, which are linear, and the Bellman optimality equations, which are not. Everything in the rest of the book is a way of solving one of them, exactly or approximately, with or without a model.&lt;/p&gt;</description></item><item><title>Dynamic Programming</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/04-dp/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/04-dp/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Dynamic programming turns&lt;/span&gt; the Bellman equations of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/03-mdp/"&gt;Chapter&amp;nbsp;3&lt;/a&gt; into assignment statements. Given a perfect model &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;p&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo mathvariant="normal" lspace="0em" rspace="0em"&gt;′&lt;/mo&gt;&lt;/msup&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mo&gt;∣&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;p(s&amp;#x27;, r \mid s, a)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; it computes &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;v_\pi&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; by repeatedly replacing the left side of &lt;span class="eqref"&gt;&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/03-mdp/#eq-mdp-bellman-v"&gt;(3.9)&lt;/a&gt;&lt;/span&gt; with its right side, and computes &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mo&gt;∗&lt;/mo&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;v_*&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; the same way from &lt;span class="eqref"&gt;&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/03-mdp/#eq-mdp-bellman-opt-v"&gt;(3.17)&lt;/a&gt;&lt;/span&gt;.&lt;label for="sn-11f3f4-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-11f3f4-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;; and &lt;span class="bib-entry" data-cite="bellman1957"&gt;Richard Bellman. &lt;cite&gt;Dynamic Programming&lt;/cite&gt;. Princeton University Press, Princeton, NJ, 1957. A Rand Corporation Research Study; xxv+342 pp.&lt;/span&gt;&lt;/span&gt; The assumption of a perfect model and the cost of sweeping the whole state set limit its direct use, but almost every method in the rest of the book is an attempt to get the effect of dynamic programming (DP) with less computation and without the model. This chapter proves that the assignments work — they are contractions — proves the policy improvement theorem, and assembles policy iteration and value iteration from the two pieces. The pattern that emerges, generalized policy iteration, is the organizing idea of the whole book.&lt;/p&gt;</description></item><item><title>Monte Carlo Methods</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/05-monte-carlo/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/05-monte-carlo/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Dynamic programming needs&lt;/span&gt; the full distribution &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;p&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo mathvariant="normal" lspace="0em" rspace="0em"&gt;′&lt;/mo&gt;&lt;/msup&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mo&gt;∣&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;p(s&amp;#x27;, r \mid s, a)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;;&lt;/span&gt; the methods of this chapter need only &lt;em&gt;episodes&lt;/em&gt;. A value is an expected return, so it can be estimated the way any expectation is estimated: run the policy, record what happened, and average.&lt;label for="sn-d1e484-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-d1e484-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; That idea, applied state by state, is all of Monte Carlo prediction. Turning it into a control method requires two more ingredients met in earlier chapters. From &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/02-bandits/"&gt;Chapter&amp;nbsp;2&lt;/a&gt; comes the need to &lt;em&gt;keep exploring&lt;/em&gt;, because an action that is never tried is never evaluated. From &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/04-dp/"&gt;Chapter&amp;nbsp;4&lt;/a&gt; comes generalized policy iteration (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/04-dp/#sec:dp-gpi"&gt;Section&amp;nbsp;4.7&lt;/a&gt;), the alternation of evaluation and improvement that works even when neither is carried out completely. The new difficulty, and the theme of the second half of the chapter, is learning about one policy while behaving according to another. Its tool is importance sampling, and its two variants, ordinary and weighted, trade bias against variance in a way that will reappear in every off-policy method of the book.&lt;/p&gt;</description></item><item><title>Temporal-Difference Learning</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/06-td/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/06-td/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Monte Carlo waits&lt;/span&gt; for the end of the episode, because only then is the return known; dynamic programming does not wait for anything, but it needs a model. Temporal-difference (TD) learning takes the sampling of the first and the bootstrapping of the second: after a single transition it moves the estimate of the state it has left toward the reward just received plus the &lt;em&gt;estimated&lt;/em&gt; value of the state it has reached.&lt;label for="sn-ad380d-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-ad380d-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton1988"&gt;Richard S. Sutton. Learning to Predict by the Methods of Temporal Differences. &lt;cite&gt;Machine Learning&lt;/cite&gt;, 3(1):9–44, 1988. &lt;span class="smallcaps"&gt;doi:&lt;/span&gt; &lt;a href="https://doi.org/10.1007/BF00115009"&gt;10.1007/BF00115009&lt;/a&gt;&lt;/span&gt;; and &lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; Sutton and Barto call it the idea that is &amp;ldquo;central and novel to reinforcement learning&amp;rdquo;, and this chapter shows why. TD learning converges to the right answer, it is faster than Monte Carlo on Markov problems for a reason that can be stated precisely (it computes the maximum-likelihood model&amp;rsquo;s values without building the model), and its control versions, Sarsa and Q-learning, are the two most widely used algorithms of the field. They also bring a new pathology, maximization bias, with a remedy whose descendants run in today&amp;rsquo;s deep reinforcement learning.&lt;/p&gt;</description></item><item><title>n-step Bootstrapping</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/07-nstep/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/07-nstep/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Monte Carlo waits for the end&lt;/span&gt; of the episode and uses the whole return; one-step TD uses a single reward and then trusts the current estimate for everything that follows. Nothing forces us to choose between these two. We can wait &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; steps, sum the &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; rewards we have seen, and only then bootstrap. This chapter studies the whole family of such methods. They are worth having for two reasons. Intermediate values of &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; often learn faster than either extreme. And they decouple two time scales that one-step methods tie together: how often the agent acts, and how far ahead it looks before trusting its own estimates. Sutton and Barto call this escaping &amp;ldquo;the tyranny of the time step&amp;rdquo;.&lt;label for="sn-e8cc28-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-e8cc28-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; The chapter also takes off-policy learning further than &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/05-monte-carlo/"&gt;Chapter&amp;nbsp;5&lt;/a&gt; and &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/06-td/"&gt;Chapter&amp;nbsp;6&lt;/a&gt; did. We meet three ideas, importance sampling with per-decision control variates, tree backups that need no importance sampling at all, and the algorithm &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;Q&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;σ&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;Q(\sigma)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; which contains both.&lt;/p&gt;</description></item><item><title>Planning and Learning with Tabular Methods</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/08-planning/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/08-planning/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Dynamic programming needs a model&lt;/span&gt; of the environment, and Monte Carlo and TD learning do not. Up to now this has been presented as the line that separates two families: &lt;strong&gt;model-based&lt;/strong&gt;&lt;span class="index-anchor" data-index="model-based reinforcement learning"&gt;&lt;/span&gt; methods, which &lt;em&gt;plan&lt;/em&gt;, and &lt;strong&gt;model-free&lt;/strong&gt;&lt;span class="index-anchor" data-index="model-free reinforcement learning"&gt;&lt;/span&gt; methods, which &lt;em&gt;learn&lt;/em&gt;. This chapter argues that the line is thin. Both kinds of method compute value functions, and both do it by backing values up along possible trajectories. They differ in where the trajectories come from: a model or the world. Once this is seen, a learning rule can be used as a planner just by feeding it simulated experience, and planning, acting and learning can run together in one agent. The previous chapters joined Monte Carlo and TD learning through the &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-step methods of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/07-nstep/"&gt;Chapter&amp;nbsp;7&lt;/a&gt;; this one joins both to dynamic programming. The second half of the chapter is about &lt;em&gt;where&lt;/em&gt; to spend computation: which states to update, in which order, with which kind of update, and whether to plan in the background or at the moment of decision. That last question leads to Monte Carlo Tree Search and, beyond the book, to the learned-model search of AlphaZero and MuZero.&lt;/p&gt;</description></item><item><title>On-policy Prediction with Approximation</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/09-prediction-approx/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/09-prediction-approx/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;A table cannot generalize.&lt;/span&gt; Every method of Part I, up to the Dyna and tree-search planners of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/08-planning/"&gt;Chapter&amp;nbsp;8&lt;/a&gt;, stores one number per state (or per state–action pair), and learning about one state teaches nothing about any other. In a game of backgammon, a camera image or a robot&amp;rsquo;s sensor readings, almost every state the agent meets is new, so this is no longer a question of memory alone: a table would never be filled. In this chapter we replace the table by a parameterized function &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mover accent="true"&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mo&gt;^&lt;/mo&gt;&lt;/mover&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;𝐰&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;mo&gt;≈&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;v&lt;/mi&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/msub&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\hat v(s, \mathbf{w}) \approx v_\pi(s)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; with a weight vector &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;𝐰&lt;/mi&gt;&lt;mo&gt;∈&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;ℝ&lt;/mi&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\mathbf{w} \in \mathbb{R}^d&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;mo&gt;≪&lt;/mo&gt;&lt;mi mathvariant="normal"&gt;∣&lt;/mi&gt;&lt;mi&gt;𝒮&lt;/mi&gt;&lt;mi mathvariant="normal"&gt;∣&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;d \ll |\mathcal{S}|&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; and ask what happens to the prediction problem of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/06-td/"&gt;Chapter&amp;nbsp;6&lt;/a&gt; when changing one weight changes the estimated value of many states at once.&lt;label for="sn-c64f94-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-c64f94-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; The answer has three parts: an objective that says which errors matter, the &lt;em&gt;semi-gradient&lt;/em&gt; methods that bootstrap towards it, and, for linear functions, a complete theory of where semi-gradient TD converges and how far that point can be from the best possible one.&lt;/p&gt;</description></item><item><title>On-policy Control with Approximation</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/10-control-approx/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/10-control-approx/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Control with a function approximator&lt;/span&gt; looks at first like a routine extension of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/09-prediction-approx/"&gt;Chapter&amp;nbsp;9&lt;/a&gt;: approximate action values &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mover accent="true"&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mo&gt;^&lt;/mo&gt;&lt;/mover&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;𝐰&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;mo&gt;≈&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;q&lt;/mi&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/msub&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\hat q(s, a, \mathbf{w}) \approx q_\pi(s, a)&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; instead of state values, act &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;ε&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\varepsilon&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-greedily with respect to them, and let generalized policy iteration do the rest.&lt;label for="sn-ed8bb6-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-ed8bb6-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; For episodic tasks this is exactly what we do, and the result is semi-gradient Sarsa. For continuing tasks the extension forces a surprising retreat. Once states can no longer be told apart, the discounted formulation stops defining a sensible problem: averaged over the states the policy visits, the discounted value of &lt;em&gt;every&lt;/em&gt; policy is its average reward divided by &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn&gt;1&lt;/mn&gt;&lt;mo&gt;−&lt;/mo&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;1 - \gamma&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; whatever &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;γ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\gamma&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; is. We therefore replace discounting by the &lt;strong&gt;average-reward&lt;/strong&gt; setting, with &lt;em&gt;differential&lt;/em&gt; returns, values, Bellman equations and TD errors. This chapter develops both halves and proves the facts on which the change of setting rests.&lt;/p&gt;</description></item><item><title>Off-policy Methods with Approximation</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/11-offpolicy-approx/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/11-offpolicy-approx/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Tabular Q-learning makes&lt;/span&gt; off-policy learning look easy: learn about the greedy policy while behaving in any sufficiently exploratory way, and convergence is guaranteed. &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/10-control-approx/"&gt;Chapter&amp;nbsp;10&lt;/a&gt; carried on-policy control over to function approximation and stopped short of Q-learning. With function approximation the off-policy idea becomes treacherous. The difficulty has two parts. The first, already met in the tabular case, concerns the &lt;em&gt;targets&lt;/em&gt; of the updates: returns generated by a behavior policy &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;b&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; must be corrected, by importance sampling or by expectations, to say something about a target policy &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\pi&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;.&lt;/span&gt; The second part is new and is the real subject of this chapter. It concerns the &lt;em&gt;distribution&lt;/em&gt; of the updates. In &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/09-prediction-approx/"&gt;Chapter&amp;nbsp;9&lt;/a&gt; the stability of semi-gradient TD rested, silently, on the fact that states were updated in proportion to how often &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\pi&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; visits them. Off-policy, they are updated as often as &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;b&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;b&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; visits them, and that is enough to make the simplest linear TD method diverge. We first locate the mechanism of divergence exactly, in one matrix inequality; then we look at the geometry of linear value functions to see which objectives could be optimized instead; and we end with the two families of stable algorithms, Gradient-TD and Emphatic-TD, that this analysis produces.&lt;label for="sn-08c79b-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-08c79b-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Eligibility Traces</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/12-traces/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/12-traces/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;An eligibility trace is&lt;/span&gt; the mechanism that turns the one-step methods of the last three chapters into multi-step ones without waiting for the future: a short-term memory vector &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;𝐳&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;∈&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;ℝ&lt;/mi&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\mathbf{z}_t \in \mathbb{R}^d&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; that runs alongside the long-term weight vector &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;𝐰&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\mathbf{w}_t&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;.&lt;/span&gt; When a component of &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;𝐰&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\mathbf{w}&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; helps to produce an estimate, the matching component of &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;𝐳&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\mathbf{z}&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; is bumped up and then fades; if a TD error arrives before it has faded, that component learns. The &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-step methods of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/07-nstep/"&gt;Chapter&amp;nbsp;7&lt;/a&gt; already interpolate between one-step TD and Monte Carlo, but they must store the last &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; feature vectors and they learn &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; steps late. A trace needs one vector and learns at once. The chapter develops one idea in several layers. First we define an ideal &lt;em&gt;forward view&lt;/em&gt;, the &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\lambda&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-return, which looks ahead from each state to a geometric mixture of all &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;n&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;n&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-step returns. Then we find &lt;em&gt;backward views&lt;/em&gt;, algorithms that look back from the current TD error along the trace, and prove that they implement the forward view, approximately for TD(&lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\lambda&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt; and exactly for true online TD(&lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\lambda&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;).&lt;/span&gt; Finally we generalize the forward view, to variable bootstrapping and discounting and to off-policy data, and read off the corresponding traces.&lt;label for="sn-6eb703-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-6eb703-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Policy Gradient Methods</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/13-policy-gradient/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/13-policy-gradient/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Every control method so far&lt;/span&gt;, up to the Sarsa(&lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\lambda&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt; of &lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/12-traces/"&gt;Chapter&amp;nbsp;12&lt;/a&gt;, has been built on action values: learn &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;Q&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;Q&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; then act greedily or &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;ε&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\varepsilon&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;-greedily with respect to it, so that the policy exists only as a by-product of the value estimates. This chapter turns the construction around. The policy itself becomes the object of learning, a differentiable function &lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;π&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;∣&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;mi&gt;𝜽&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;mo&gt;≐&lt;/mo&gt;&lt;mi&gt;Pr&lt;/mi&gt;&lt;mo&gt;⁡&lt;/mo&gt;&lt;mo stretchy="false"&gt;{&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;A&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;mo&gt;∣&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;S&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;s&lt;/mi&gt;&lt;mo separator="true"&gt;,&lt;/mo&gt;&lt;msub&gt;&lt;mi&gt;𝜽&lt;/mi&gt;&lt;mi&gt;t&lt;/mi&gt;&lt;/msub&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;𝜽&lt;/mi&gt;&lt;mo stretchy="false"&gt;}&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\pi(a \mid s, \boldsymbol{\theta}) \doteq \Pr\{A_t = a \mid S_t = s, \boldsymbol{\theta}_t = \boldsymbol{\theta}\}&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt; of a parameter &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;𝜽&lt;/mi&gt;&lt;mo&gt;∈&lt;/mo&gt;&lt;msup&gt;&lt;mi&gt;ℝ&lt;/mi&gt;&lt;msup&gt;&lt;mi&gt;d&lt;/mi&gt;&lt;mo mathvariant="normal" lspace="0em" rspace="0em"&gt;′&lt;/mo&gt;&lt;/msup&gt;&lt;/msup&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\boldsymbol{\theta} \in \mathbb{R}^{d&amp;#x27;}&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;,&lt;/span&gt; and it is improved by &lt;strong&gt;stochastic gradient ascent&lt;/strong&gt;&lt;span class="index-anchor" data-index="policy gradient method"&gt;&lt;/span&gt; on a scalar performance measure &lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;J&lt;/mi&gt;&lt;mo stretchy="false"&gt;(&lt;/mo&gt;&lt;mi&gt;𝜽&lt;/mi&gt;&lt;mo stretchy="false"&gt;)&lt;/mo&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;J(\boldsymbol{\theta})&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;:&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Psychology and Neuroscience</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/14-mind-and-brain/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/14-mind-and-brain/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Temporal-difference learning was invented&lt;/span&gt; to solve a computational problem, and only afterwards did it turn out to describe, with uncomfortable precision, what rabbits learn about tones and air puffs and what dopamine neurons in a monkey&amp;rsquo;s midbrain do when juice arrives. Part II ended with actor–critic methods (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-2/13-policy-gradient/"&gt;Chapter&amp;nbsp;13&lt;/a&gt;), in which one TD error trains both a critic and an actor; Part III opens by finding that architecture, and that error, in animals. This chapter condenses Sutton and Barto&amp;rsquo;s two chapters on psychology and neuroscience into one argument.&lt;label for="sn-56c261-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-56c261-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; Its thread is a single equation, the TD error &lt;span class="eqref"&gt;&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-1/06-td/#eq-td-error"&gt;(6.2)&lt;/a&gt;&lt;/span&gt;, read three times: as a theory of &lt;em&gt;classical conditioning&lt;/em&gt; that generalizes the Rescorla–Wagner model, as a theory of the &lt;em&gt;phasic activity of dopamine neurons&lt;/em&gt;, and as the &lt;em&gt;reinforcement signal&lt;/em&gt; of an actor–critic architecture spread over the striatum. Around this thread we place the rest of the correspondences: instrumental conditioning and the law of effect, eligibility traces and delayed reinforcement, cognitive maps and the split between habitual and goal-directed behavior, and a TD model of addiction. Our aim is to derive what the book shows by simulation: blocking, second-order conditioning, the backward migration of the TD error, and the unbounded values of Redish&amp;rsquo;s addiction model all follow from short exact calculations.&lt;/p&gt;</description></item><item><title>Applications and Case Studies</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/15-applications/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/15-applications/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Every case study in this chapter&lt;/span&gt; is assembled from parts we already own. The previous chapter (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/14-mind-and-brain/"&gt;Chapter&amp;nbsp;14&lt;/a&gt;) found the TD error at work in animals; here it is at work in machines built to play, wager, schedule and fly. TD-Gammon is semi-gradient TD(&lt;span class="tufte-nobr"&gt;&lt;span class="katex tufte-math-euler"&gt;&lt;span class="katex-mathml"&gt;&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;λ&lt;/mi&gt;&lt;/mrow&gt;&lt;annotation encoding="application/x-tex"&gt;\lambda&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;/span&gt;)&lt;/span&gt; with a neural network; DQN is semi-gradient Q-learning; AlphaGo Zero is policy iteration in which Monte Carlo tree search performs the improvement step; Watson&amp;rsquo;s wagering is the identity &amp;ldquo;an action value is the expected value of the next state&amp;rdquo;. None of the algorithms is new. What is new is the engineering around them: how the state is presented to the learner, what the reward actually rewards, where the experience comes from (self-play, a simulator, a log of past interactions), and how learned values are combined with search at decision time. Sutton and Barto put it plainly: applications &amp;ldquo;typically require as much art as science&amp;rdquo;.&lt;label for="sn-412270-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-412270-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; We read each case study with the same five questions in mind: what is the problem, how are states, actions and rewards defined, which algorithm of the earlier chapters is being run, what made it work, and what it taught the field. The chapter closes with a survey of the case studies that came after the book was published.&lt;/p&gt;</description></item><item><title>Frontiers</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/16-frontiers/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/16-frontiers/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;Throughout this companion&lt;/span&gt;, from the bandits of Part I to the case studies of the previous chapter (&lt;a class="xref" href="https://massimo-nocentini.github.io/book/reinforcement-learning/part-3/15-applications/"&gt;Chapter&amp;nbsp;15&lt;/a&gt;), three assumptions have been held fixed: the agent predicts one thing, the sum of future rewards; it acts at one time scale, the time step of the MDP; and it is handed a state with the Markov property. Each was a simplification, and each fails for any agent living in a world as rich as ours. Sutton and Barto&amp;rsquo;s last chapter relaxes them in turn: value functions become predictions of arbitrary signals, actions become temporally extended options, and states become something the agent must construct from observations.&lt;label for="sn-c87ef1-1" class="margin-toggle sidenote-number"&gt;&lt;/label&gt;&lt;input type="checkbox" id="sn-c87ef1-1" class="margin-toggle"/&gt;&lt;span class="sidenote citation"&gt;&lt;span class="bib-entry" data-cite="sutton2018"&gt;Richard S. Sutton and Andrew G. Barto. &lt;cite&gt;Reinforcement Learning: An Introduction&lt;/cite&gt;. Adaptive Computation and Machine Learning. MIT Press, Cambridge, MA, second edition, 2018. ISBN 978-0-262-03924-6. URL &lt;a href="http://incompleteideas.net/book/the-book-2nd.html"&gt;http://incompleteideas.net/book/the-book-2nd.html&lt;/a&gt;&lt;/span&gt;&lt;/span&gt; It then turns to the one input that was never questioned, the reward signal, and asks how it should be designed. We follow the same path, with proofs where the book only describes (the Bellman equations of option models, the invariance of potential-based shaping) and symbolic checks on small examples, and close with what happened next: distributional and offline reinforcement learning, learned world models, the reward hypothesis debate and the problem of learning continually, before a last look back over the whole companion.&lt;/p&gt;</description></item><item><title>Mathematical Toolkit</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/appendix-toolkit/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/appendix-toolkit/</guid><description>&lt;p&gt;&lt;span class="newthought"&gt;A handful of mathematical tools&lt;/span&gt; carry almost every argument in this companion: conditional expectations turn the recursive definition of the return into Bellman equations; contraction mappings make dynamic programming converge; Markov chains supply the distributions over which approximation errors are measured; stochastic approximation explains why sample-based updates with decreasing step sizes find what their expectations point to; importance sampling and the log-derivative trick turn expectations under one distribution into expectations under another, or into gradients; and the Sherman–Morrison formula makes least-squares TD incremental. This appendix states each tool precisely, proves it (or sketches the proof where the full argument belongs to a specialist text), and checks it in the Wolfram Language.&lt;/p&gt;</description></item><item><title>Bibliography</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/bibliography/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/bibliography/</guid></item><item><title>List of Figures</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/list-of-figures/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/list-of-figures/</guid></item><item><title>List of Algorithms, Theorems and Definitions</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/list-of-theorems/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/list-of-theorems/</guid></item><item><title>Index</title><link>https://massimo-nocentini.github.io/book/reinforcement-learning/general-index/</link><dc:creator>Massimo Nocentini</dc:creator><guid>https://massimo-nocentini.github.io/book/reinforcement-learning/general-index/</guid></item></channel></rss>