<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl">
	<id>http://brain.fuw.edu.pl/edu/index.php?action=history&amp;feed=atom&amp;title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe%2FWyk%C5%82ad_11</id>
	<title>Uczenie maszynowe i sztuczne sieci neuronowe/Wykład 11 - Historia wersji</title>
	<link rel="self" type="application/atom+xml" href="http://brain.fuw.edu.pl/edu/index.php?action=history&amp;feed=atom&amp;title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe%2FWyk%C5%82ad_11"/>
	<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;action=history"/>
	<updated>2026-04-29T05:50:02Z</updated>
	<subtitle>Historia wersji tej strony wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7777&amp;oldid=prev</id>
		<title>Jarekz: /* Algorytm aktualizacji funkcji Q */</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7777&amp;oldid=prev"/>
		<updated>2018-05-25T15:43:33Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Algorytm aktualizacji funkcji Q&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Wersja z 15:43, 25 maj 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l443&quot; &gt;Linia 443:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 443:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** przechodzi do nowego stanu &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; ( to może zależeć od poprzedniego stanu  &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; i wybranej akcji),  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** przechodzi do nowego stanu &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; ( to może zależeć od poprzedniego stanu  &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; i wybranej akcji),  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; jest uaktualniane:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; jest uaktualniane:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:::&amp;lt;math&amp;gt;Q(s_{t},a_{t}) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\leftarrow &lt;/del&gt;(1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm stara~wartosc} + &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\underbrace{&lt;/del&gt;\alpha&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}_{\textrm szybkosc~uczenia} &lt;/del&gt;\cdot  \overbrace{\bigg( &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\underbrace{&lt;/del&gt;R_{t&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}}_{\textrm nagroda&lt;/del&gt;} +{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estymata~optymalnej~przyszlej~wartosci} \bigg) }^{\textrm &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;nauczona&lt;/del&gt;~&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wartosc&lt;/del&gt;} &amp;lt;/math&amp;gt;,  &lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:::&amp;lt;math&amp;gt;Q(s_{t},a_{t}) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:= &lt;/ins&gt;(1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;{ &lt;/ins&gt;stara~wartosc&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/ins&gt;} + \alpha \cdot  \overbrace{\bigg( R_{t} +{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;{ &lt;/ins&gt;estymata~optymalnej~przyszlej~wartosci&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/ins&gt;} \bigg) }^{\textrm&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;{nowa~informacja~o~wartości&lt;/ins&gt;~&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;pary } (s_t,a_t)&lt;/ins&gt;}&amp;lt;/math&amp;gt;,  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** gdzie ''&amp;lt;math&amp;gt;R_{t}&amp;lt;/math&amp;gt;'' nagroda w bieżącym stanie &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, i &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; jest prędkością uczenia (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** gdzie ''&amp;lt;math&amp;gt;R_{t}&amp;lt;/math&amp;gt;'' nagroda w bieżącym stanie &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, i &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; jest prędkością uczenia (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Epizod nauki kończy się gdy &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; jest stanem końcowym.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;** Epizod nauki kończy się gdy &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; jest stanem końcowym.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7776&amp;oldid=prev</id>
		<title>Jarekz: /* Algorytm aktualizacji funkcji Q */</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7776&amp;oldid=prev"/>
		<updated>2018-05-25T15:31:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Algorytm aktualizacji funkcji Q&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Wersja z 15:31, 25 maj 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l425&quot; &gt;Linia 425:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 425:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Początkowo funkcja  &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Q&lt;/del&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\&lt;/del&gt;math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;inicjowana jest na dowolna stałą wartość. Robot ustawiany jest &lt;/del&gt;w &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;losowej pozycji. Następnie, w każdej kolejnej chwili czasu  &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;t&lt;/del&gt;&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;robot wybiera akcję  &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a_t&lt;/del&gt;&amp;lt;/math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, dostaje nagrodę &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;R_t&lt;/del&gt;&amp;lt;/math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, przechodzi do nowego stanu &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;s_{t+1}&lt;/del&gt;&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;( to może zależeć od poprzedniego stanu &lt;/del&gt; &amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;s_t&lt;/del&gt;&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i wybranej akcji), po czym &lt;/del&gt;&amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jest uaktualniane&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Aktualizacja jest ważoną średnią dotychczasowej wartości i nowej informacji:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Jakość ta mierzona jest przez oczekiwaną wartość całkowitej nagrody za wykonanie danej akcji &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;a&lt;/ins&gt;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;/&lt;/ins&gt;math&amp;gt; w &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;stanie &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;s&lt;/ins&gt;&amp;lt;/math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Czyli dla optymalnej funkcji &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Q^*&lt;/ins&gt;&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;V^*&lt;/ins&gt;&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;zachodzi związek:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;V^*(s) = \max_a Q^*(s,a) &lt;/ins&gt;&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Najlepszą strategią jest zatem wybieranie akcji &lt;/ins&gt; &amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;\arg \max_a Q^*(s,a) &lt;/ins&gt;&amp;lt;/math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;\pi^*(s) = \arg \max_a &lt;/ins&gt;Q&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;^*(s,a) &lt;/ins&gt;&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&amp;lt;math&amp;gt;Q&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(s_{t},a_{t}) \leftarrow (1-\alpha) \cdot \underbrace{&lt;/del&gt;Q&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(s_{t},a_{t})}_{\textrm stara~wartosc} + \underbrace{\alpha}_{\textrm szybkosc~uczenia} \cdot  \overbrace{\bigg( \underbrace{R_{t}}_{\textrm nagroda} +{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estymata~optymalnej~przyszlej~wartosci} \bigg) }^{\textrm nauczona~wartosc} &lt;/del&gt;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;math&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Funkcję &lt;/ins&gt;&amp;lt;math&amp;gt;Q&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/math&amp;gt; można znaleźć poprzez aktualizacje ważoną średnią dotychczasowej wartości i nowej informacji:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;b&amp;gt;iteracja funkcji &lt;/ins&gt;Q&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;b&lt;/ins&gt;&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdzie ''&lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;R_{t}&lt;/del&gt;&amp;lt;/math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'' nagroda w bieżącym stanie &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;s_t&amp;lt;/math&amp;gt;&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &amp;lt;math&amp;gt;\alpha&lt;/del&gt;&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jest prędkością uczenia &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;&lt;/del&gt;)&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;1. inicjuj dla każdego &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;s&lt;/ins&gt;&amp;lt;/math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;: &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Q(s&lt;/ins&gt;,&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;a) = 0&lt;/ins&gt;&amp;lt;/math&amp;gt; (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wypełniamy tablicę Q zerami&lt;/ins&gt;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Epizod nauki kończy się gdy &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; jest stanem końcowym.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2. Powtarzaj aż zbiegniesz:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;{&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* Robot ustawiany jest w losowej pozycji. &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;* Przejdź epizod:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** w każdej kolejnej chwili czasu  &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; robot wybiera akcję  &amp;lt;math&amp;gt;a_t&amp;lt;/math&amp;gt;, &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** dostaje nagrodę &amp;lt;math&amp;gt;R_t&amp;lt;/math&amp;gt;, &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** przechodzi do nowego stanu &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; ( to może zależeć od poprzedniego stanu  &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; i wybranej akcji), &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; jest uaktualniane:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:::&amp;lt;math&amp;gt;Q(s_{t},a_{t}) \leftarrow (1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm stara~wartosc} + \underbrace{\alpha}_{\textrm szybkosc~uczenia} \cdot  \overbrace{\bigg( \underbrace{R_{t}}_{\textrm nagroda} +{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estymata~optymalnej~przyszlej~wartosci} \bigg) }^{\textrm nauczona~wartosc} &amp;lt;/math&amp;gt;, &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** gdzie ''&amp;lt;math&amp;gt;R_{t}&amp;lt;/math&amp;gt;'' nagroda w bieżącym stanie &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, i &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; jest prędkością uczenia (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;** &lt;/ins&gt;Epizod nauki kończy się gdy &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; jest stanem końcowym.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Estymowanie modelu dla MDP==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Estymowanie modelu dla MDP==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7775&amp;oldid=prev</id>
		<title>Jarekz: /* Algorytm aktualizacji funkcji Q */</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7775&amp;oldid=prev"/>
		<updated>2018-05-25T15:09:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Algorytm aktualizacji funkcji Q&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Wersja z 15:09, 25 maj 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l421&quot; &gt;Linia 421:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 421:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Algorytm aktualizacji funkcji Q ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Algorytm aktualizacji funkcji Q ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Optymalną strategię można też wyznaczyć wprowadzając funkcje jakości &amp;lt;math&amp;gt;Q&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\&lt;/del&gt;math&amp;gt; (quality). Funkcja &amp;lt;math&amp;gt;Q&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\&lt;/del&gt;math&amp;gt; zwraca jakość dla kombinacji stan-akcja:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Optymalną strategię można też wyznaczyć wprowadzając funkcje jakości &amp;lt;math&amp;gt;Q&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;/&lt;/ins&gt;math&amp;gt; (quality). Funkcja &amp;lt;math&amp;gt;Q&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;/&lt;/ins&gt;math&amp;gt; zwraca jakość dla kombinacji stan-akcja:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7774&amp;oldid=prev</id>
		<title>Jarekz: /* Algorytm aktualizacji funkcji Q */</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7774&amp;oldid=prev"/>
		<updated>2018-05-25T15:09:08Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Algorytm aktualizacji funkcji Q&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Wersja z 15:09, 25 maj 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l425&quot; &gt;Linia 425:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 425:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Początkowo funkcja  &amp;lt;math&amp;gt;Q&amp;lt;\math&amp;gt; inicjowana jest na dowolna stałą wartość. Następnie w każdej kolejnej chwili czasu  &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; robot wybiera akcję  &amp;lt;math&amp;gt;a_t&amp;lt;/math&amp;gt;, dostaje nagrodę &amp;lt;math&amp;gt;R_t&amp;lt;/math&amp;gt;, przechodzi do nowego stanu &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; ( to może zależeć od poprzedniego stanu  &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; i wybranej akcji), po czym &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; jest uaktualniane. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jądro algorytmu &lt;/del&gt;jest &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;prostą aktualizacją wartości oczekiwanej, wykorzystując &lt;/del&gt;ważoną średnią dotychczasowej wartości i nowej informacji:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Początkowo funkcja  &amp;lt;math&amp;gt;Q&amp;lt;\math&amp;gt; inicjowana jest na dowolna stałą wartość&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Robot ustawiany jest w losowej pozycji&lt;/ins&gt;. Następnie&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/ins&gt;w każdej kolejnej chwili czasu  &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; robot wybiera akcję  &amp;lt;math&amp;gt;a_t&amp;lt;/math&amp;gt;, dostaje nagrodę &amp;lt;math&amp;gt;R_t&amp;lt;/math&amp;gt;, przechodzi do nowego stanu &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; ( to może zależeć od poprzedniego stanu  &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; i wybranej akcji), po czym &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; jest uaktualniane. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Aktualizacja &lt;/ins&gt;jest ważoną średnią dotychczasowej wartości i nowej informacji:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q(s_{t},a_{t}) \leftarrow (1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm stara~&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wartość&lt;/del&gt;} + \underbrace{\alpha}_{\textrm &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;szybkość&lt;/del&gt;~uczenia} \cdot  \overbrace{\bigg( \underbrace{&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;r_&lt;/del&gt;{t}}_{\textrm nagroda} +{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estymata~optymalnej~&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;przyszłej&lt;/del&gt;~&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wartości&lt;/del&gt;} \bigg) }^{\textrm nauczona~&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wartość&lt;/del&gt;} &amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q(s_{t},a_{t}) \leftarrow (1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm stara~&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wartosc&lt;/ins&gt;} + \underbrace{\alpha}_{\textrm &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;szybkosc&lt;/ins&gt;~uczenia} \cdot  \overbrace{\bigg( \underbrace{&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;R_&lt;/ins&gt;{t}}_{\textrm nagroda} +{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estymata~optymalnej~&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;przyszlej&lt;/ins&gt;~&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wartosci&lt;/ins&gt;} \bigg) }^{\textrm nauczona~&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wartosc&lt;/ins&gt;} &amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;gdzie ''&amp;lt;math&amp;gt;R_{t}&amp;lt;/math&amp;gt;'' nagroda w bieżącym stanie &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, i &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; jest prędkością uczenia (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;gdzie ''&amp;lt;math&amp;gt;R_{t}&amp;lt;/math&amp;gt;'' nagroda w bieżącym stanie &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, i &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; jest prędkością uczenia (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7773&amp;oldid=prev</id>
		<title>Jarekz: /* Algorytm aktualizacji funkcji Q */</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7773&amp;oldid=prev"/>
		<updated>2018-05-25T15:04:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Algorytm aktualizacji funkcji Q&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Wersja z 15:04, 25 maj 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l421&quot; &gt;Linia 421:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 421:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Algorytm aktualizacji funkcji Q ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Algorytm aktualizacji funkcji Q ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Optymalną strategię można też wyznaczyć wprowadzając funkcje jakości &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Q (quality). Funkcja Q &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Optymalną strategię można też wyznaczyć wprowadzając funkcje jakości &amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Q&lt;/ins&gt;&amp;lt;\math&amp;gt; (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;quality&lt;/ins&gt;). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Funkcja &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Q&lt;/ins&gt;&amp;lt;\math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;zwraca jakość dla kombinacji stan&lt;/ins&gt;-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;akcja&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The weight for a step from a state &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\Delta t&amp;lt;/math&amp;gt; steps into the future is calculated as &amp;lt;math&amp;gt;\gamma^{\Delta t}&lt;/del&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;/math&amp;gt;. &amp;lt;math&amp;gt;&lt;/del&gt;\&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gamma&amp;lt;/&lt;/del&gt;math&amp;gt; (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the ''discount factor'') is a number between 0 and 1 (&amp;lt;math&amp;gt;0 \le \gamma \le 1&amp;lt;/math&amp;gt;) and has the effect of valuing rewards received earlier higher than those received later (reflecting the value of a &amp;quot;good start&amp;quot;&lt;/del&gt;). &amp;lt;math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\gamma &amp;lt;/math&amp;gt; may also be interpreted as the probability to succeed (or survive) at every step &lt;/del&gt;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;math&amp;gt;&lt;/del&gt;\&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Delta t&amp;lt;/&lt;/del&gt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The algorithm, therefore, has a function that calculates the quality of a state&lt;/del&gt;-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;action combination&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Before learning begins, {{tmath|&lt;/del&gt;Q&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}} is initialized to a possibly arbitrary fixed value (chosen by the programmer)&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Then, at each time &lt;/del&gt;&amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the agent selects an action &lt;/del&gt;&amp;lt;math&amp;gt;a_t&amp;lt;/math&amp;gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;observes a reward &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;r_t&lt;/del&gt;&amp;lt;/math&amp;gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;enters a new state &lt;/del&gt;&amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;that may depend on both the previous state &lt;/del&gt;&amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;and the selected action&lt;/del&gt;), &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/del&gt;&amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is updated&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;The core of the algorithm is a simple [[Markov decision process#Value iteration|value iteration update]]&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;using the weighted average of the old value and the new information&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Początkowo funkcja  &amp;lt;math&amp;gt;&lt;/ins&gt;Q&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;\math&amp;gt; inicjowana jest na dowolna stałą wartość&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Następnie w każdej kolejnej chwili czasu  &lt;/ins&gt;&amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;robot wybiera akcję  &lt;/ins&gt;&amp;lt;math&amp;gt;a_t&amp;lt;/math&amp;gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;dostaje nagrodę &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;R_t&lt;/ins&gt;&amp;lt;/math&amp;gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;przechodzi do nowego stanu &lt;/ins&gt;&amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; ( &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to może zależeć od poprzedniego stanu  &lt;/ins&gt;&amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;i wybranej akcji&lt;/ins&gt;), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;po czym &lt;/ins&gt;&amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;jest uaktualniane&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Jądro algorytmu jest prostą aktualizacją wartości oczekiwanej&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wykorzystując ważoną średnią dotychczasowej wartości i nowej informacji&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&amp;lt;math&amp;gt;Q(s_{t},a_{t}) \leftarrow (1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm old~value} + \underbrace{\alpha}_{\textrm learning~rate} \cdot  \overbrace{\bigg( \underbrace{r_{t}}_{\textrm reward} + \underbrace{\gamma}_{\textrm discount~factor} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estimate~of~optimal~future~value} \bigg) }^{\textrm learned~value} &amp;lt;/math&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;where ''&amp;lt;math&amp;gt;r_{t}&amp;lt;/math&amp;gt;'' is the reward observed for the current state &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is the learning rate (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;An episode of the algorithm ends when state &lt;/del&gt;&amp;lt;math&amp;gt;s_{t&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;+&lt;/del&gt;1}&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/math&amp;gt; is a final or ''terminal state''. However&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''Q''-learning can also learn in non-episodic tasks.&lt;/del&gt;{{&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;citation needed|date=December 2017&lt;/del&gt;}} &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;If the discount factor is lower than &lt;/del&gt;1, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;the action values are finite even if the problem can contain infinite loops.&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Q(&lt;/ins&gt;s_{t&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;},a_{t}) \leftarrow (&lt;/ins&gt;1&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;-\alpha) \cdot \underbrace{Q(s_{t&lt;/ins&gt;},&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;a_{t})}_{\textrm stara~wartość} + \underbrace{\alpha}_{\textrm szybkość~uczenia} \cdot  \overbrace{\bigg( \underbrace&lt;/ins&gt;{&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;r_&lt;/ins&gt;{&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;t}&lt;/ins&gt;}&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;_{\textrm nagroda&lt;/ins&gt;} &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;+{\gamma} \cdot \underbrace{\max_{a}Q(s_{t+&lt;/ins&gt;1&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;a)}_{\textrm estymata~optymalnej~przyszłej~wartości} \bigg) }^{\textrm nauczona~wartość} &amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;For all final states &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;s_f&lt;/del&gt;&amp;lt;/math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Q(s_f, a)&lt;/del&gt;&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;is never updated&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;but is set to the reward value &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;r&lt;/del&gt;&amp;lt;/math&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;observed for state &lt;/del&gt;&amp;lt;math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;s_f&lt;/del&gt;&amp;lt;/math&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. In most cases, &amp;lt;math&amp;gt;Q(s_f,a&lt;/del&gt;)&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;/math&amp;gt; can be taken to be equal to zero&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;gdzie ''&lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;R_{t}&lt;/ins&gt;&amp;lt;/math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;'' nagroda w bieżącym stanie &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;s_t&lt;/ins&gt;&amp;lt;/math&amp;gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;\alpha&lt;/ins&gt;&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;jest prędkością uczenia (&lt;/ins&gt;&amp;lt;math&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;0 &amp;lt; \alpha \le 1&lt;/ins&gt;&amp;lt;/math&amp;gt;).&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Epizod nauki kończy się gdy &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; jest stanem końcowym.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Estymowanie modelu dla MDP==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Estymowanie modelu dla MDP==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7772&amp;oldid=prev</id>
		<title>Jarekz: /* Estymowanie modelu dla MDP */</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=7772&amp;oldid=prev"/>
		<updated>2018-05-25T10:03:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Estymowanie modelu dla MDP&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pl&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← poprzednia wersja&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Wersja z 10:03, 25 maj 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l418&quot; &gt;Linia 418:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linia 418:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Dla małych i średnich problemów MDP iteracja strategii jest szybko zbieżna, ale dla dużych problemów staje się kosztowna obliczeniowo.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Dla małych i średnich problemów MDP iteracja strategii jest szybko zbieżna, ale dla dużych problemów staje się kosztowna obliczeniowo.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== Algorytm aktualizacji funkcji Q ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Optymalną strategię można też wyznaczyć wprowadzając funkcje jakości Q (quality). Funkcja Q &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The weight for a step from a state &amp;lt;math&amp;gt;\Delta t&amp;lt;/math&amp;gt; steps into the future is calculated as &amp;lt;math&amp;gt;\gamma^{\Delta t}&amp;lt;/math&amp;gt;. &amp;lt;math&amp;gt;\gamma&amp;lt;/math&amp;gt; (the ''discount factor'') is a number between 0 and 1 (&amp;lt;math&amp;gt;0 \le \gamma \le 1&amp;lt;/math&amp;gt;) and has the effect of valuing rewards received earlier higher than those received later (reflecting the value of a &amp;quot;good start&amp;quot;). &amp;lt;math&amp;gt; \gamma &amp;lt;/math&amp;gt; may also be interpreted as the probability to succeed (or survive) at every step &amp;lt;math&amp;gt;\Delta t&amp;lt;/math&amp;gt;.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;The algorithm, therefore, has a function that calculates the quality of a state-action combination:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:&amp;lt;math&amp;gt;Q: S \times A \to \mathbb{R}&amp;lt;/math&amp;gt; .&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Before learning begins, {{tmath|Q}} is initialized to a possibly arbitrary fixed value (chosen by the programmer). Then, at each time &amp;lt;math&amp;gt;t&amp;lt;/math&amp;gt; the agent selects an action &amp;lt;math&amp;gt;a_t&amp;lt;/math&amp;gt;, observes a reward &amp;lt;math&amp;gt;r_t&amp;lt;/math&amp;gt;, enters a new state &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; (that may depend on both the previous state &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt; and the selected action), and &amp;lt;math&amp;gt;Q&amp;lt;/math&amp;gt; is updated. The core of the algorithm is a simple [[Markov decision process#Value iteration|value iteration update]], using the weighted average of the old value and the new information:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;:&amp;lt;math&amp;gt;Q(s_{t},a_{t}) \leftarrow (1-\alpha) \cdot \underbrace{Q(s_{t},a_{t})}_{\textrm old~value} + \underbrace{\alpha}_{\textrm learning~rate} \cdot  \overbrace{\bigg( \underbrace{r_{t}}_{\textrm reward} + \underbrace{\gamma}_{\textrm discount~factor} \cdot \underbrace{\max_{a}Q(s_{t+1}, a)}_{\textrm estimate~of~optimal~future~value} \bigg) }^{\textrm learned~value} &amp;lt;/math&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;where ''&amp;lt;math&amp;gt;r_{t}&amp;lt;/math&amp;gt;'' is the reward observed for the current state &amp;lt;math&amp;gt;s_t&amp;lt;/math&amp;gt;, and &amp;lt;math&amp;gt;\alpha&amp;lt;/math&amp;gt; is the learning rate (&amp;lt;math&amp;gt;0 &amp;lt; \alpha \le 1&amp;lt;/math&amp;gt;).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;An episode of the algorithm ends when state &amp;lt;math&amp;gt;s_{t+1}&amp;lt;/math&amp;gt; is a final or ''terminal state''. However, ''Q''-learning can also learn in non-episodic tasks.{{citation needed|date=December 2017}} If the discount factor is lower than 1, the action values are finite even if the problem can contain infinite loops.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;For all final states &amp;lt;math&amp;gt;s_f&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;Q(s_f, a)&amp;lt;/math&amp;gt; is never updated, but is set to the reward value &amp;lt;math&amp;gt;r&amp;lt;/math&amp;gt; observed for state &amp;lt;math&amp;gt;s_f&amp;lt;/math&amp;gt;. In most cases, &amp;lt;math&amp;gt;Q(s_f,a)&amp;lt;/math&amp;gt; can be taken to be equal to zero.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
	<entry>
		<id>http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=819&amp;oldid=prev</id>
		<title>Jarekz: Utworzono nową stronę &quot;==Uczenie ze wzmocnieniem==  W dotychczasowych wykładach zajmowaliśmy się dwoma skrajnymi typami uczenia: uczenie z nadzorem i bez nadzoru. W pierwszym typie ciąg uc...&quot;</title>
		<link rel="alternate" type="text/html" href="http://brain.fuw.edu.pl/edu/index.php?title=Uczenie_maszynowe_i_sztuczne_sieci_neuronowe/Wyk%C5%82ad_11&amp;diff=819&amp;oldid=prev"/>
		<updated>2015-05-21T18:11:46Z</updated>

		<summary type="html">&lt;p&gt;Utworzono nową stronę &amp;quot;==Uczenie ze wzmocnieniem==  W dotychczasowych wykładach zajmowaliśmy się dwoma skrajnymi typami uczenia: uczenie z nadzorem i bez nadzoru. W pierwszym typie ciąg uc...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nowa strona&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Uczenie ze wzmocnieniem==&lt;br /&gt;
&lt;br /&gt;
W dotychczasowych wykładach zajmowaliśmy się dwoma skrajnymi typami uczenia: uczenie z nadzorem i bez nadzoru. W pierwszym typie ciąg uczący zawiera wektory wejściowe i pożądane wartości wyjściowe. Na podstawie takiego zbioru możliwe jest bezpośrednie policzenie błędu popełnionego przez algorytm uczący i wyliczenie konkretnych poprawek. Drugą skrajnością były algorytmy analizy skupień bazujące na korelacjach między wejściem i wyjściem oraz na strukturze danych wejściowych.&lt;br /&gt;
&lt;br /&gt;
W tym wykładzie zajmiemy się sytuacją pośrednią. Dla każdego wejścia nie znamy co prawda prawidłowej wartości wyjścia, ale umiemy powiedzieć czy było ono dobre czy złe. Przypomina to trochę uczenie psa aportowania. Nie da się psu wytłumaczyć jak ma to zrobić, jedynie w wypadku powodzenia pies dostaje pochwałę/nagrodę a w przypadku niepowodzenia nic.&lt;br /&gt;
Podobnie w uczeniu ze wzmocnieniem będziemy jedynie wiedzieli kiedy algorytm nagrodzić (będziemy do tego używać funkcji nagrody) a kiedy karać.&lt;br /&gt;
&lt;br /&gt;
Specyficznym problemem jest tu przypisanie kary za błąd. Zwykle w zadaniach których rozwiązania chcielibyśmy nauczyć maszynę występuje wiele etapów i nie jest do końca jasne który z nich przyczynił się do ostatecznego błędu. Można tu jako przykład rozważyć grę w szachy. Jeśli po 60 posunięciach partia się kończy naszą przegraną to nie jest jasne, który z naszych ruchów był nieprawidłowy.&lt;br /&gt;
&lt;br /&gt;
Algorytmy tego typu znajdują bardzo wiele praktycznych zastosowań np: algorytmy do gier strategicznych, sterowanie robotami, optymalizacja przesyłania danych w sieciach komórkowych, efektywne indeksowanie stron internetowych itp.&lt;br /&gt;
Zaczniemy od omówienia procesu decyzyjnego Markowa (ang. Markov decision process MDP), który dostarcza formalizmu do opisu uczenia ze wzmocnieniem.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Proces decyzyjny Markowa==&lt;br /&gt;
&lt;br /&gt;
Aby mówić o procesie decyzyjnym Markowa musimy zdefiniować następujący zestaw (krotkę): &amp;lt;math&amp;gt;(S,A,\lbrace P_{sa}\rbrace ,\gamma ,R)&amp;lt;/math&amp;gt; gdzie:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	&amp;lt;math&amp;gt;S&amp;lt;/math&amp;gt; jest zbiorem możliwych stanów, w jakich może znajdować się rozważany układ.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	&amp;lt;math&amp;gt;A&amp;lt;/math&amp;gt; to zbiór możliwych akcji&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	&amp;lt;math&amp;gt;P_{s,a}&amp;lt;/math&amp;gt; to rozkład prawdopodobieństwa przejścia z bieżącego stanu do każdego z możliwych stanów, tak, że &amp;lt;math&amp;gt;P_{s,a_{i}}(s^{\prime })&amp;lt;/math&amp;gt; określa prawdopodobieństwo z jakim układ znajdujący się w stanie &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; po wyborze akcji &amp;lt;math&amp;gt;a_{i}&amp;lt;/math&amp;gt; znajdzie się w stanie &amp;lt;math&amp;gt;s^{\prime }&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	&amp;lt;math&amp;gt;\gamma &amp;lt;/math&amp;gt; to współczynnik o wartości &amp;lt;math&amp;gt;[0,1)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	&amp;lt;math&amp;gt;R: S\times A \mapsto \mathcal {R}&amp;lt;/math&amp;gt; to funkcja nagrody.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Aby &amp;quot;uruchomić&amp;quot; MDP potrzebna jest &amp;lt;i&amp;gt;strategia&amp;lt;/i&amp;gt;, czyli mechanizm wybierania akcji. Formalnie strategia &amp;lt;math&amp;gt;\pi : S \mapsto A&amp;lt;/math&amp;gt; to funkcja, która mapuje stany na akcje. Czyli jeśli znajdujemy się w stanie &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; to akcje wybieramy tak: &amp;lt;math&amp;gt; a= \pi (s)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Działanie MDP można opisać następująco: Początkowo układ znajduje się w stanie &amp;lt;math&amp;gt;s_{0}&amp;lt;/math&amp;gt;. Zgodnie ze strategią &amp;lt;math&amp;gt;\pi (s_{0})&amp;lt;/math&amp;gt; wybierana jest akcja &amp;lt;math&amp;gt;a_{0}&amp;lt;/math&amp;gt;. W sposób losowy, zgodnie z rozkładem &amp;lt;math&amp;gt;P_{s_{0},a_{0}}&amp;lt;/math&amp;gt; akcja &amp;lt;math&amp;gt;a_{0}&amp;lt;/math&amp;gt; przenosi układ do stanu &amp;lt;math&amp;gt;s_{1}&amp;lt;/math&amp;gt;.&lt;br /&gt;
Następnie strategia &amp;lt;math&amp;gt;\pi (s_{1})&amp;lt;/math&amp;gt; decyduje jaką akcję &amp;lt;math&amp;gt;a_{1}&amp;lt;/math&amp;gt; wykonamy i z prawdopodobieństwem &amp;lt;math&amp;gt;P_{s_{1},a_{1}}&amp;lt;/math&amp;gt; przejdziemy do stanu &amp;lt;math&amp;gt;s_{2}&amp;lt;/math&amp;gt;, itd. Na obrazku wygląda to tak:&lt;br /&gt;
&lt;br /&gt;
@=0.5cm&lt;br /&gt;
s0 [r]a0 s1 [r]a1 s2 [r]a2 s3[r]a3  …&lt;br /&gt;
&lt;br /&gt;
Aby te pojęcia nabrały znaczenia rozważmy konkretny przykład. Mamy robota, &amp;quot;żyjącego&amp;quot; w świecie złożonym z 12 pól takim jak na poniższym rysunku (RYS).&lt;br /&gt;
&lt;br /&gt;
[[File:swiat_robota.png|350px|thumb|&amp;lt;figure id=&amp;quot;uid6&amp;quot; /&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
Zajmowanie przez robota pola o konkretnych współrzędnych to jego stan, np. jeśli robot znajduje się w lewym górnym rogu to jest w stanie &amp;lt;math&amp;gt;s = (1,3)&amp;lt;/math&amp;gt;. Jego zbiór akcji to przemieszczenie się o jedną pozycję w jednym z czterech kierunków: &amp;lt;math&amp;gt;A = \lbrace N,E,S,W\rbrace &amp;lt;/math&amp;gt;. Robot nie może wejść na czarne pole, ani przeniknąć przez ściany. Próba podjęcia takiej niemożliwej akcji skutkuje tym, że robot pozostaje w dotychczasowym stanie.&lt;br /&gt;
Chcielibyśmy, aby robot uruchomiony w takim świecie dotarł do stanu &amp;lt;math&amp;gt;(4,3)&amp;lt;/math&amp;gt; i jak tylko to możliwe unikał stanu &amp;lt;math&amp;gt;(4,2)&amp;lt;/math&amp;gt;. Przebywanie w każdym ze stanów związane jest z funkcją nagrody, zaznaczoną kolorami. Dla ustalenia uwagi weźmy funkcję nagrody taką, że stan &amp;lt;math&amp;gt;(4,3)&amp;lt;/math&amp;gt; ma nagrodę &amp;lt;math&amp;gt;R((4,3)) = +1&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;R((4,2)) = -1&amp;lt;/math&amp;gt;, pozostałe stany mają wartość &amp;lt;math&amp;gt;R = -0.02&amp;lt;/math&amp;gt;. Widać, że możemy nadawać funkcji nagrody wartości dodatnie (za przebywanie systemu w stanach, które uznajemy za korzystne) lub ujemne (w stanach mniej korzystnych).&lt;br /&gt;
Dodatkowo załóżmy, że dynamika naszego robota jest stochastyczna. Innymi słowy ruchy naszego robota nie są idealnie precyzyjne, np. jeśli dostanie polecenie &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; to przemieści się do góry z prawdopodobieństwem powiedzmy 0.8, na lewo z prawdopodobieństwem 0.1 i na prawo z prawdopodobieństwem 0.1.&lt;br /&gt;
&lt;br /&gt;
Przy takiej dynamice rozkład prawdopodobieństwa przejścia między stanami może wyglądać np. tak:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_{(3,1),N}(3,2) = 0.8&amp;lt;/math&amp;gt; (Notacja ta oznacza prawdopodobieństwo przejścia ze stanu (3,1) do (3,2) po wybraniu akcji &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_{(3,1),N}(2,1) = 0.1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_{(3,1),N}(4,1) = 0.1&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;P_{(3,1),N}(3,3) = 0&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\vdots &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Rozważmy teraz przykładowe działanie naszego robota, przyjmując strategię taką jak na poniższym rysunku.&lt;br /&gt;
(RYS)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;+1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;•&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Umieszczamy go w chwili &amp;lt;math&amp;gt;t_{0}&amp;lt;/math&amp;gt; w jakimś stanie &amp;lt;math&amp;gt;s_{0}&amp;lt;/math&amp;gt; (tzn. na którymś konkretnym polu)&lt;br /&gt;
&lt;br /&gt;
* Wybieramy akcję &amp;lt;math&amp;gt;a_{0}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* W zależności od &amp;lt;math&amp;gt;s_{0}&amp;lt;/math&amp;gt; i &amp;lt;math&amp;gt;a_{0}&amp;lt;/math&amp;gt; robot znajdzie się w stanie &amp;lt;math&amp;gt;s_{1}&amp;lt;/math&amp;gt; (Stan &amp;lt;math&amp;gt;s_{1}&amp;lt;/math&amp;gt; jest losowany z rozkładu prawdopodobieństwa &amp;lt;math&amp;gt;P_{s_{0},a_{0}}&amp;lt;/math&amp;gt; ; możemy to zapisać &amp;lt;math&amp;gt;s_{1} \sim P_{s_{0},a_{0}}&amp;lt;/math&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
* Wybieramy akcję &amp;lt;math&amp;gt;a_{1}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Losujemy stan &amp;lt;math&amp;gt;s_{2} \sim P_{s_{1},a_{1}}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\dots &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Z przebyciem konkretnej sekwencji stanów związany jest całkowity zysk, który może być obliczony z funkcji nagrody w następujący sposób:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;Z = R(s_{0}) + \gamma R(s_{1})+ \gamma ^{2} R(s_{2}) + \dots &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Widzimy że współczynnik &amp;lt;math&amp;gt;\gamma &amp;lt;/math&amp;gt; odpowiadający krokowi &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; występuje w potędze &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt;. Ponieważ jest on dodatni i mniejszy niż 1 oznacza to, że na wartość oczekiwaną zysku mają największy wpływ wartości funkcji nagrody w najwcześniejszych korkach. Możemy o tym myśleć w analogii do pieniędzy: Dobrze ulokowane pieniądze przynoszą tym większy zysk im wcześniej je ulokowaliśmy.&lt;br /&gt;
&lt;br /&gt;
Naszym celem w uczeniu ze wzmocnieniem jest takie wybieranie akcji (znalezienie takiej strategii) aby zmaksymalizować wartość oczekiwaną całkowitego zysku:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;E [Z] =E [R(s_{0}) + \gamma R(s_{1})+ \gamma ^{2} R(s_{2}) + \dots ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Jak wyznaczyć optymalną strategię?==&lt;br /&gt;
&lt;br /&gt;
Pora wprowadzić pojęcie funkcji wartościującej, która posłuży do oceniania strategii: Funkcja wartościująca dla danej strategii &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt; jest to wartość oczekiwana całkowitego zysku dla przypadku gdy startujemy ze stanu &amp;lt;math&amp;gt;s_{0}&amp;lt;/math&amp;gt; i podejmujemy akcje zgodnie ze strategią &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt;.&lt;br /&gt;
Można to zapisać następująco:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;equation id=&amp;quot;uid7&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
V^{\pi }(s) = E[R(s_{0}) + \gamma R(s_{1})+ \gamma ^{2} R(s_{2}) + \dots | s_{0}=s, \pi ]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/equation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dla przykładu policzmy tą funkcje dla konkretnej strategii:&lt;br /&gt;
Strategia:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;+1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;S&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;•&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Funkcja wartościująca dla tej strategii:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;0.52&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.73&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.77&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;+1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;-0.90&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;•&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-0.82&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;-0.88&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-0.87&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-0.85&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Równanie &amp;lt;xr id=&amp;quot;uid7&amp;quot;&amp;gt; %i&amp;lt;/xr&amp;gt; można przepisać w postaci:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;equation id=&amp;quot;uid8&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
V^{\pi }(s) = E[R(s_{0}) + \gamma \left( R(s_{1})+ \gamma ^{1} R(s_{2}) + \gamma ^{2} R(s_{3})+ \dots \right) | s_{0}=s, \pi ]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/equation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Zauważmy, że wyrażenie w nawiasie: &amp;lt;math&amp;gt; R(s_{1})+ \gamma ^{1} R(s_{2}) + \gamma ^{2} R(s_{3})+ \dots &amp;lt;/math&amp;gt; to funkcja wartościująca strategi dla stanu &amp;lt;math&amp;gt;s_{1}&amp;lt;/math&amp;gt;: &amp;lt;math&amp;gt;V^{\pi }(s_{1})&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Przechodząc do notacji: &amp;lt;math&amp;gt;s_{0} \rightarrow s&amp;lt;/math&amp;gt; i &amp;lt;math&amp;gt;s_{1} \rightarrow s^{\prime }&amp;lt;/math&amp;gt; możemy funkcję wartościującą strategii wyrazić w sposób rekurencyjny:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;equation id=&amp;quot;uid9&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
V^{\pi }(s) = E[R(s) + \gamma V^{\pi }(s^{\prime }) | s_{0}=s, \pi ]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/equation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
W tym wyrażeniu &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt; jest już ustalone więc &amp;lt;math&amp;gt;E[R(s)] = R(s)&amp;lt;/math&amp;gt; natomiast &amp;lt;math&amp;gt;s^{\prime }&amp;lt;/math&amp;gt; jest zmienną losową pochodzącą z rozkładu &amp;lt;math&amp;gt;P_{s, \pi (s)}&amp;lt;/math&amp;gt; więc &amp;lt;math&amp;gt;E[V^{\pi }(s^{\prime }) ] = \sum _{s^{\prime }} P_{s, \pi (s)}(s^{\prime }) V^{\pi }(s^{\prime }) &amp;lt;/math&amp;gt;.&lt;br /&gt;
Zbierając razem te obserwacje i podstawiając je do równania (&amp;lt;xr id=&amp;quot;uid9&amp;quot;&amp;gt; %i&amp;lt;/xr&amp;gt;) otrzymujemy tzw. równanie Bellmana:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;V^{\pi }(s) = R(s) +\gamma \sum _{s^{\prime } \in S} P_{s,\pi (s)}(s^{\prime }) V^{\pi }(s^{\prime })&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
W szczególności dla MDP o skończonej ilości stanów &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; można napisać równanie Bellmana dla każdego stanu &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;. Otrzymamy wtedy układ &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; równań liniowych z &amp;lt;math&amp;gt;N&amp;lt;/math&amp;gt; niewiadomymi (&amp;lt;math&amp;gt;V^{\pi }(s)&amp;lt;/math&amp;gt;) , który można łatwo rozwiązać.&lt;br /&gt;
Popatrzmy na przykład z robotem.&lt;br /&gt;
Weźmy stan &amp;lt;math&amp;gt;(3,1)&amp;lt;/math&amp;gt; i strategię &amp;lt;math&amp;gt;\pi ((3,1)) = N&amp;lt;/math&amp;gt;. Równanie Bellmana dla tego stanu to:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;V^{\pi }\left( (3,1) \right) = R((3,1)) + \gamma [ 0.8 V^{\pi }((3,2)) +0.1 V^{\pi }((4,1)) +0.1 V^{\pi }((2,1)) ]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dla każdego z 11 stanów można napisać takie równanie. Otrzymamy 11 równań zawierających 11 niewiadomych &amp;lt;math&amp;gt;V^{\pi }(i,j)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Zdefiniujmy optymalną funkcję wartościującą strategi jako:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;&lt;br /&gt;
V^{*}(s) = \max _{\pi } V^{\pi }(s)&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Innymi słowy jest to największa możliwa suma nagród (ważonych przez &amp;lt;math&amp;gt;\gamma &amp;lt;/math&amp;gt;) przy pomocy najlepszej strategii.&lt;br /&gt;
&lt;br /&gt;
Można napisać równanie Bellmana dla &amp;lt;math&amp;gt;V^{*}(s)&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;V^{*}(s) = R(s) +\max _{a}\gamma \sum _{s^{\prime } \in S} P_{s,a}(s^{\prime }) V^{*}(s^{\prime })&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pierwszy człon to natychmiastowa nagroda.&lt;br /&gt;
W drugim członie suma wyraża wartość oczekiwaną zysku jeśli wybralibyśmy akcję &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;. Wartość ta jest maksymalizowana po &amp;lt;math&amp;gt;a&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To prowadzi do definicji strategii &amp;lt;math&amp;gt;\pi ^{*}(s)&amp;lt;/math&amp;gt;, czyli takiej strategii, która maksymalizuje zysk:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;equation id=&amp;quot;uid10&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
\pi ^{*}(s) = \arg \max _{a} \sum _{s^{\prime }} P_{sa}(s^{\prime }) V^{*}(s^{\prime })&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;/equation&amp;gt;&lt;br /&gt;
&lt;br /&gt;
W definicji tej nie musimy już uwzględniać &amp;lt;math&amp;gt;\gamma &amp;lt;/math&amp;gt; bo nie ma ona znaczenia dla operatora &amp;lt;math&amp;gt;\arg \max &amp;lt;/math&amp;gt;. Taka definicja powoduje, że akcje podejmowane zgodnie ze strategią &amp;lt;math&amp;gt;\pi ^{*}&amp;lt;/math&amp;gt; prowadzą do maksymalizacji drugiego członu w równaniu Bellmana na &amp;lt;math&amp;gt;V^{*}&amp;lt;/math&amp;gt;. W tym sensie strategia &amp;lt;math&amp;gt;\pi ^{*}&amp;lt;/math&amp;gt; jest strategią optymalną. Zauważmy, że &amp;lt;math&amp;gt;\pi ^{*}(s)&amp;lt;/math&amp;gt; jest strategią optymalną bez względu na to, z którego stanu uruchamiany jest proces.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Algorytm iteracji funkcji wartościującej===&lt;br /&gt;
&lt;br /&gt;
Powyższe definicje nie dają niestety przepisu jak obliczyć &amp;lt;math&amp;gt;\pi ^{*}&amp;lt;/math&amp;gt;. Właściwe algorytmy przedstawione są poniżej. Zauważmy, że gdybyśmy znali &amp;lt;math&amp;gt;V^{*}&amp;lt;/math&amp;gt; to można by je podstawić do (&amp;lt;xr id=&amp;quot;uid10&amp;quot;&amp;gt; %i&amp;lt;/xr&amp;gt;) aby wyznaczyć &amp;lt;math&amp;gt;\pi ^{*}&amp;lt;/math&amp;gt;. Zatem pierwszy algorytm, który prowadzi do wyznaczenia optymalnej strategi to:&lt;br /&gt;
&amp;lt;b&amp;gt;iteracja funkcji wartościującej&amp;lt;/b&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
1. inicjuj dla każdego &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;: &amp;lt;math&amp;gt;V(s) = 0&amp;lt;/math&amp;gt; (wypełniamy tablicę V zerami)&lt;br /&gt;
&lt;br /&gt;
2. Powtarzaj aż zbiegniesz:&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
dla każdego stanu &amp;lt;math&amp;gt;s&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;V(s) = R(s) + \max _{a} \gamma \sum _{s^{\prime }} P_{sa}(s^{\prime }) V(s^{\prime }) &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Tak iterowane &amp;lt;math&amp;gt;V(s) \rightarrow V^{*}(s)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
W algorytmie tym można zastosować uaktualnianie synchroniczne - wtedy najpierw obliczamy wszystkie prawe strony, wyniki obliczeń przechowując w zmiennej tymczasowej i dopiero po przebiegnięciu pętlą przez wszystkie stany następuje przypisanie uaktualniające. Druga możliwość to uaktualnianie asynchroniczne, tzn. w każdym kroku wybieramy jeden stan i uaktualniamy &amp;lt;math&amp;gt;V(s)&amp;lt;/math&amp;gt; dla tego stanu. W kolejnym kroku do obliczeń używamy już tego uaktualnionego &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt;. Algorytm asynchroniczny jest zwykle nieco szybciej zbieżny niż synchroniczny. Po wyznaczeniu &amp;lt;math&amp;gt;V^{*}&amp;lt;/math&amp;gt; można go podstawić do równania &amp;lt;xr id=&amp;quot;uid10&amp;quot;&amp;gt; %i&amp;lt;/xr&amp;gt; i wyznaczyć optymalną strategię.&lt;br /&gt;
&lt;br /&gt;
Stosując ten algorytm do naszego przykładu można otrzymać np. taka funkcję wartościującą &amp;lt;math&amp;gt;V^{*}&amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;0.86&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.90&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.93&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;+1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;0.82&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;•&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.69&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;0.78&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.73&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.71&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;0.49&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Podstawiając do równania na &amp;lt;math&amp;gt;\pi ^{*}&amp;lt;/math&amp;gt; dostajemy, przykładowo dla stanu s= (3,1):&lt;br /&gt;
Dla akcji W:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;\sum _{s^{\prime }} P_{sa}(s^{\prime })V^{*}(s^{\prime }) = 0.8\cdot 0.73 + 0.1\cdot 0.69 + 0.1\cdot 0.71 = 0.724 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dla akcji N:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;\sum _{s^{\prime }} P_{sa}(s^{\prime })V^{*}(s^{\prime }) = 0.8\cdot 0.69 + 0.1\cdot 0.73 + 0.1\cdot 0.49 = 0.674 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dla akcji E:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;\sum _{s^{\prime }} P_{sa}(s^{\prime })V^{*}(s^{\prime }) = 0.8\cdot 0.49 + 0.1\cdot 0.69 + 0.1\cdot 0.71 = 0.532 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Dla akcji S:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;\sum _{s^{\prime }} P_{sa}(s^{\prime })V^{*}(s^{\prime }) = 0.8\cdot 0.71 + 0.1\cdot 0.73 + 0.1\cdot 0.49 = 0.690 &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Zatem dla tego stanu wybrana byłaby akcja W. Analogiczne obliczenia trzeba przeprowadzić dla pozostałych stanów. Wyniki końcowe prezentuje poniższa tabela.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table class=&amp;quot;wikitable&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;E&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;+1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;•&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;-1&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
	&amp;lt;tr&amp;gt;&lt;br /&gt;
		&amp;lt;td&amp;gt;N&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		&amp;lt;td&amp;gt;W&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Algorytm iteracji strategii===&lt;br /&gt;
&lt;br /&gt;
Poniżej zaprezentowany jest algorytm iteracji strategii.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	inicjujemy &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt; w sposób losowy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	Powtarzaj, aż zbiegniesz:&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
rozwiąż równania Bellmana dla aktualnej strategii (dla procesów o bardzo dużej ilości stanów może to być nieefektywne):&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;V = V^{\pi }&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Następnie oblicz lepsze &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;\pi (s) = \arg \max _{a} \sum _{s^{\prime }}P_{sa}(s^{\prime }) V(s^{\prime })&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Okazuje się, że powyższa iteracja daje &amp;lt;math&amp;gt;V \rightarrow V^{*}&amp;lt;/math&amp;gt; zaś &amp;lt;math&amp;gt;\pi \rightarrow \pi ^{*}&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Dla małych i średnich problemów MDP iteracja strategii jest szybko zbieżna, ale dla dużych problemów staje się kosztowna obliczeniowo.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Estymowanie modelu dla MDP==&lt;br /&gt;
&lt;br /&gt;
Na początku powiedzieliśmy, że MDP jest określony przez podanie następującej krotki: &amp;lt;math&amp;gt;(S,A,\lbrace P_{sa}\rbrace ,\gamma ,R)&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Stany i możliwe akcje zwykle wynikają w sposób naturalny z rozważanego problemu. &amp;lt;math&amp;gt;\gamma &amp;lt;/math&amp;gt; i &amp;lt;math&amp;gt;R&amp;lt;/math&amp;gt; wybieramy sami. Najtrudniejsze do wymyślenia &amp;lt;i&amp;gt;ad hoc&amp;lt;/i&amp;gt; są prawdopodobieństwa przejść. Można jednak wyestymować je z danych (przez obserwację wielu realizacji procesu). Używamy wtedy estymatora największej wiarygodności, tzn:&lt;br /&gt;
&lt;br /&gt;
::&amp;lt;math&amp;gt;P_{sa}(s^{\prime }) = \frac{\#\text{ kiedy wybrano akcje }a\text{ w stanie }s\text{ i otrzymano stan }s^{\prime }}{\#\text{ kiedy wybrano akcję }a\text{ w stanie }s}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Zatem dla MDP o nieznanych prawdopodobieństwach przejść można zastosować następujący algorytm:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	inicjalizuj &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt; losowo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	powtarzaj aż zbiegniesz:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	Wykonaj strategię &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt; w MDP dla pewnej liczby prób.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	Na podstawie zaobserwowanych sekwencji stanów estymuj &amp;lt;math&amp;gt;P_{sa}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	zastosuj algorytm iteracji funkcji wartościującej aby oszacować &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;li&amp;gt;&lt;br /&gt;
	Uaktualnij &amp;lt;math&amp;gt;\pi &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
W powyższym zastosowaniu algorytm iteracji funkcji wartościującej można zmodyfikować tak, aby nie zaczynał on za każdym razem inicjalizacji od &amp;lt;math&amp;gt;V(s) = 0&amp;lt;/math&amp;gt;, ale od &amp;lt;math&amp;gt;V&amp;lt;/math&amp;gt; które uzyskano w poprzednim kroku zewnętrznej pętli.&lt;/div&gt;</summary>
		<author><name>Jarekz</name></author>
		
	</entry>
</feed>