import{s as ie,f as A,n as ne,o as ae}from"../chunks/scheduler.37c15a92.js";import{S as le,i as se,g as r,s as l,r as N,A as re,h as u,f as i,c as s,j as V,u as X,x as $,k as a,y as ue,a as n,v as Y,d as Z,t as ee,w as te}from"../chunks/index.7cb9c9b8.js";import{H as oe,E as ce}from"../chunks/EditOnGithub.858acfec.js";function me(S){let o,x,L,M,f,y,h,U="<em>Q-Learning</em> <strong>is the RL algorithm that</strong> :",T,v,z="<li><p>Trains a <em>Q-function</em>, an <strong>action-value function</strong> encoded, in internal memory, by a <em>Q-table</em> <strong>containing all the state-action pair values.</strong></p></li> <li><p>Given a state and action, our Q-function <strong>will search its Q-table for the corresponding value.</strong></p></li>",H,c,B,P,d,O=`<li><p>When the training is done, <strong>we have an optimal Q-function, or, equivalently, an optimal Q-table.</strong></p></li> <li><p>And if we <strong>have an optimal Q-function</strong>, we
have an optimal policy, since we <strong>know, for each state, the best action to take.</strong></p></li>`,k,m,W,q,_,D="But, in the beginning, our <strong>Q-table is useless since it gives arbitrary values for each state-action pair (most of the time we initialize the Q-table to 0 values)</strong>. But, as we explore the environment and update our Q-table it will give us a better and better approximation.",C,p,F,j,w,J="This is the Q-Learning pseudocode:",E,g,K,G,b,I,Q,R;return f=new oe({props:{title:"Q-Learning Recap",local:"q-learning-recap",headingTag:"h1"}}),b=new ce({props:{source:"https://github.com/huggingface/deep-rl-class/blob/main/units/en/unit2/q-learning-recap.mdx"}}),{c(){o=r("meta"),x=l(),L=r("p"),M=l(),N(f.$$.fragment),y=l(),h=r("p"),h.innerHTML=U,T=l(),v=r("ul"),v.innerHTML=z,H=l(),c=r("img"),P=l(),d=r("ul"),d.innerHTML=O,k=l(),m=r("img"),q=l(),_=r("p"),_.innerHTML=D,C=l(),p=r("img"),j=l(),w=r("p"),w.textContent=J,E=l(),g=r("img"),G=l(),N(b.$$.fragment),I=l(),Q=r("p"),this.h()},l(e){const t=re("svelte-u9bgzb",document.head);o=u(t,"META",{name:!0,content:!0}),t.forEach(i),x=s(e),L=u(e,"P",{}),V(L).forEach(i),M=s(e),X(f.$$.fragment,e),y=s(e),h=u(e,"P",{"data-svelte-h":!0}),$(h)!=="svelte-1fyydrl"&&(h.innerHTML=U),T=s(e),v=u(e,"UL",{"data-svelte-h":!0}),$(v)!=="svelte-1e71du7"&&(v.innerHTML=z),H=s(e),c=u(e,"IMG",{src:!0,alt:!0,width:!0}),P=s(e),d=u(e,"UL",{"data-svelte-h":!0}),$(d)!=="svelte-e8l1t"&&(d.innerHTML=O),k=s(e),m=u(e,"IMG",{src:!0,alt:!0,width:!0}),q=s(e),_=u(e,"P",{"data-svelte-h":!0}),$(_)!=="svelte-1vjk65k"&&(_.innerHTML=D),C=s(e),p=u(e,"IMG",{src:!0,alt:!0,width:!0}),j=s(e),w=u(e,"P",{"data-svelte-h":!0}),$(w)!=="svelte-1v1evpe"&&(w.textContent=J),E=s(e),g=u(e,"IMG",{src:!0,alt:!0,width:!0}),G=s(e),X(b.$$.fragment,e),I=s(e),Q=u(e,"P",{}),V(Q).forEach(i),this.h()},h(){a(o,"name","hf:doc:metadata"),a(o,"content",pe),A(c.src,B="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit3/Q-function-2.jpg")||a(c,"src",B),a(c,"alt","Q function"),a(c,"width","100%"),A(m.src,W="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit3/link-value-policy.jpg")||a(m,"src",W),a(m,"alt","Link value policy"),a(m,"width","100%"),A(p.src,F="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/notebooks/unit2/q-learning.jpeg")||a(p,"src",F),a(p,"alt","q-learning.jpeg"),a(p,"width","100%"),A(g.src,K="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit3/Q-learning-2.jpg")||a(g,"src",K),a(g,"alt","Q-Learning"),a(g,"width","100%")},m(e,t){ue(document.head,o),n(e,x,t),n(e,L,t),n(e,M,t),Y(f,e,t),n(e,y,t),n(e,h,t),n(e,T,t),n(e,v,t),n(e,H,t),n(e,c,t),n(e,P,t),n(e,d,t),n(e,k,t),n(e,m,t),n(e,q,t),n(e,_,t),n(e,C,t),n(e,p,t),n(e,j,t),n(e,w,t),n(e,E,t),n(e,g,t),n(e,G,t),Y(b,e,t),n(e,I,t),n(e,Q,t),R=!0},p:ne,i(e){R||(Z(f.$$.fragment,e),Z(b.$$.fragment,e),R=!0)},o(e){ee(f.$$.fragment,e),ee(b.$$.fragment,e),R=!1},d(e){e&&(i(x),i(L),i(M),i(y),i(h),i(T),i(v),i(H),i(c),i(P),i(d),i(k),i(m),i(q),i(_),i(C),i(p),i(j),i(w),i(E),i(g),i(G),i(I),i(Q)),i(o),te(f,e),te(b,e)}}}const pe='{"title":"Q-Learning Recap","local":"q-learning-recap","sections":[],"depth":1}';function ge(S){return ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class de extends le{constructor(o){super(),se(this,o,ge,me,ie,{})}}export{de as component};
