<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Uğurcan Özalp on Medium]]></title>
        <description><![CDATA[Stories by Uğurcan Özalp on Medium]]></description>
        <link>https://medium.com/@ugurcanozalp?source=rss-a4a74bd0a8bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5EkGg-neWnbJWxRIGEAgpg.jpeg</url>
            <title>Stories by Uğurcan Özalp on Medium</title>
            <link>https://medium.com/@ugurcanozalp?source=rss-a4a74bd0a8bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:48:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ugurcanozalp/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Simple Outline of Reinforcement Learning]]></title>
            <link>https://medium.com/data-science/a-simple-outline-of-reinforcement-learning-4c20ddc497c9?source=rss-a4a74bd0a8bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c20ddc497c9</guid>
            <category><![CDATA[robots]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Uğurcan Özalp]]></dc:creator>
            <pubDate>Thu, 13 May 2021 11:03:24 GMT</pubDate>
            <atom:updated>2021-05-15T05:36:19.206Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s make a tour where artificial intelligence and control meet</h4><blockquote><strong>“What we want is a machine that can learn from experience.”<br>Alan Turing, 1947</strong></blockquote><p>Do you know how machines (or computers) are able to surpass human performance in complex games like chess and go (DeepMind’s AlphaGo, AlphaZero and MuZero), or drive cars without human intervention? The answer is hidden in the way they are programmed. Such machines are programmed to maximize some objective, which is explicitly defined by humans. This approach is called Reinforcement Learning, and completely mimics how humans and animals learns to act in world.</p><p>In this article, I aimed to explain what Reinforcement Learning is and the basics without going too much details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-JN_NSxktVfZWY_a" /><figcaption>Photo by <a href="https://unsplash.com/@ninjason?utm_source=medium&amp;utm_medium=referral">Jason Leung</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>What makes Reinforcement Learning so special?</h3><p>Today, Machine Learning is outlined by 3 main paradigm. Along with Supervised Learning (SL) and Unsupervised Learning (UL), Reinforcement Learning (RL) forms 3rd and last one. Although it is a sub field of Machine Learning, it has drawbacks to Control Theory and Game Theory.</p><p>We can think of an intelligent agent as a function, expected to give a useful output (or action) when fed with an input (or observation). Learning is just getting closer to give a correct (or useful) output.</p><p>In SL, agent is fed by both inputs and corresponding correct outputs to make it learn to give reasonable outputs to unseen inputs.</p><p>UL is feeding agent with only inputs and make agent to learn to give some outputs which optimizes a predefined objective like compactness or entropy like measures.</p><p>The problem of RL arises when an agent is required to learn behavior through trial-and-error encountering with a dynamic environment. This is how humans and animals learn their behavior such as utterance and movement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*JVqOSrN7hYEoyILdofwY0g.png" /><figcaption>Illustration of Learning Types, Photo by <a href="https://developer.ibm.com/articles/cc-models-machine-learning/">IBM</a></figcaption></figure><p>Unlike stated above, learning methods do not need to be discriminated sharply. If thought from a bigger perspective, all of them are based on optimization of some objective. In recent years, many successful AI applications are hybrid of those 3 paradigms, like self-supervised learning, inverse reinforcement learning etc. Recent successes on ML is hidden in defining proper objectives, but not selecting one of 3 learning type.</p><p>However, RL is still unique because it is dealing with dynamic environment, and data is not given beforehand. As a result, unlike SL and UL, a RL agent should;</p><ul><li>gather data itself,</li><li>explore environment (learn how to gather useful data),</li><li>exploit its knowledge (learn how to act considering future states, learning best policy),</li><li>discriminate reason of consequences (which actions in the past caused instant situation),</li><li>keep itself safe during exploration (for mechanical applications).</li></ul><h4>Exploration Exploitation Dilemma</h4><p>As stated above, the agent should <em>exploit</em> its knowledge to have optimal policy. However, without sufficient knowledge on environment, agent may stuck to local optimal solution. Therefore, agent should <em>explore</em> the environment at the same time. This emerges exploration-exploitation dilemma, which is most important part of RL. Many algorithms have various techniques to balance them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UW7kUxeh1sbeELzwhZ7U8A.png" /><figcaption>Where the agent should eat?, Photo by <a href="http://ai.berkeley.edu/slides/Lecture%2011%20--%20Reinforcement%20Learning%20II/SP14%20CS188%20Lecture%2011%20--%20Reinforcement%20Learning%20II.pptx"><em>UC Berkeley CS188 AI course</em></a></figcaption></figure><p>Now, let get into technical details.</p><h3>Sequential Decision Making</h3><p>Sequential Decision Making, or Discrete Control Process is making a decision at each time step in discrete time, considering dynamics of the environment.</p><p>At time t, our agent is in state sₜ, rewarded by rₜ, and gets observation oₜ, and takes action aₜ according to its policy <strong>π </strong>. As a result of action, state transition happens to sₜ₊₁ and new observation oₜ₊₁ comes with reward rₜ₊₁.</p><p>Observations are expected to represent state of the agent. If state can be formed using instant observations, observations are directly used as states (sₜ=oₜ) and this is called Markov Decision Process. If not, it is called Partially Observable Markov Decision Process, since instant observations are not capable of informing agent about the state totally. However, we focus on MDP for now.</p><h4>Markov Decision Process (MDP)</h4><p>MDP consists of the following;</p><ul><li>State space S, as a set of all possible states.</li><li>Action space A, as a set of all possible actions.</li><li>Model Function T(s’|s,a), as a state transition probabilities.</li><li>Reward Function R(s), as rewarding mapping from state, action, next state tuple to reward.</li><li>Discount Factor γ ∈ [0,1], a real number determining importance of future rewards for control objective.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*zvBfCEKABTBRmujyefi3vg.png" /><figcaption>Markov Decision Process, Image by Author</figcaption></figure><h4>Building Units for RL</h4><ul><li>Policy Function π(a|s): Probabilistic function for actions depending on states, indicating how to act in a certain situation.</li><li>Return G: Cumulative sum of future rewards in time, scaled by discount factor γ. It is defined as;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/1*SUMgV6sFBU7BBGV4YLC3BQ.gif" /><figcaption>Return value</figcaption></figure><ul><li>Value Function V(s|π): Expected return when policy π is followed at state s, defined as;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*sCf4aZq5Ji55kVpCzeZr0g.gif" /><figcaption>Value Function</figcaption></figure><ul><li>Action-Value Function Q(s,a|π): Expected return when policy π is followed, except action a at first step at state s, defined as;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*kg2Genq6u-foByG6pY_m2A.gif" /><figcaption>Action Value function, a.k.a Q Function</figcaption></figure><h4>Bellman Equation</h4><p>The whole aim of RL is maximization of value function V for an optimal policy π*. To do so, value function must satisfy following Bellman Equation. Bellman Equation tells us that optimal policy must maximize value function (cumulative rewards in the future) in average for all possible states, in an implicit way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*Du5YIc1Mq-N1OH6QR_N7EQ.gif" /><figcaption>Belmann Equation</figcaption></figure><p>You may wonder why we need Q function. There exist a direct relation with it and policy, which is;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/161/1*GL_TQLzZnO6u-ILXMMzeCA.gif" /><figcaption>Policy derivation from Q function</figcaption></figure><p>Note that both of them depends on each other. So why do we need another definition? By observing environment and consequences of actions, agent can learn Q function for the current policy. Then, agent can improve its policy using this equation. It allows agent to improve policy throughout learning as it learns Q function at the same time.</p><h4>Model Free Reinforcement Learning</h4><p>Model Free RL is purely based on experience with absence of model and reward functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*xY9ydZ_QCM-gJ9DzFq8ATw.png" /><figcaption>Photo by <a href="http://ai.berkeley.edu/slides/Lecture%2010%20--%20Reinforcement%20Learning%20I/SP14%20CS188%20Lecture%2010%20--%20Reinforcement%20Learning%20I.pptx"><em>UC Berkeley CS188 AI course</em></a></figcaption></figure><h4>Monte Carlo Methods</h4><p>Monte Carlo Methods uses statistical sampling to approximate Q function. In order to use such methods, one must wait until simulation ends because cumulative sum of rewards in the future is used for each state.</p><p>Once state sₜ is visited and action aₜ is taken, return Gₜ is calculated from its definition using instant and future rewards waiting to end of episode. Monte Carlo methods aim to minimize the gap between Q(sₜ,aₜ) and target value Gₜ for all possible samples.</p><p>With a predetermined learning rate α, Q function is updated as;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*cUzL09PsnTqTf1IP3Hlvog.gif" /><figcaption>Monte Carlo Q update</figcaption></figure><h4>Temporal Difference (TD) Methods</h4><p>Temporal Difference (TD) methods bootstrap Q function estimate for target return. This allows agent to update Q function from each reward.</p><p>Main TD methods are SARSA and Q Learning.</p><ul><li>SARSA minimizes gap between Q(sₜ,aₜ) and target value rₜ₊₁+γ Q(sₜ₊₁,aₜ₊₁) which is bootstrapped estimate of return. Since next actions are also required, it is named SARSA indicating state, action, reward, state, action sequence. With a learning rate α, Q is updated by;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*RE_RjVLpv2zHYzRHFjf8eQ.gif" /><figcaption>SARSA Q update</figcaption></figure><ul><li>Q Learning minimizes gap Q(sₜ,aₜ) and target value rₜ₊₁+γ max Q(sₜ₊₁,·) which is also a bootstrapped estimate of return. Unlike SARSA, it does not need next actions, and assumes best action is taken at the next state. With a learning rate α, Q is updated by;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*HQR9PvHi0AmSj4mzLm_xVw.gif" /><figcaption>Q Learning Q update</figcaption></figure><h3>Model Based Reinforcement Learning</h3><p>In model based RL, model and reward function are either given beforehand, or learned by SL methods.</p><p>Model based RL is dependent on the quality of the learned model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7xdSHhAPhwkWoSWzKsUUJA.png" /><figcaption>Photo by <a href="http://ai.berkeley.edu/slides/Lecture%2010%20--%20Reinforcement%20Learning%20I/SP14%20CS188%20Lecture%2010%20--%20Reinforcement%20Learning%20I.pptx"><em>UC Berkeley CS188 AI course</em></a></figcaption></figure><h4>Dynamic Programming</h4><p>Dynamic Programming do not require sampling. It is analytically solving for an optimal policy given model and reward function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*tmPF5iVIjMKmRVJwUUajeg.gif" /><figcaption>Dynamic Programming Q update</figcaption></figure><h4>Simulation Based Search</h4><p>Sometimes, state and action spaces are too large. This makes Dynamic Programming inapplicable. In such cases, random simulation paths are generated. The rest is usual Model Free RL, and one can use Monte Carlo, or Temporal Difference methods. Only advantage of such approach that agent simulate starting from whichever state it wants to.</p><p>A comparison between Monte Carlo, Temporal Difference methods and Dynamic Programming can be illustrated as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlHmZLmY0MvwEwoBBapJTA.png" /><figcaption>Backup Diagrams of 3 main approaches, Photo by <a href="https://www.davidsilver.uk/wp-content/uploads/2020/03/MC-TD.pdf">David Silver’s RL Course, Lecture 4</a></figcaption></figure><h3>Conclusion</h3><p>In most applications, RL is combined by Deep Learning called Deep Reinforcement Learning. Recent success of RL is correlated with neural networks. However, RL suffers to adapt in real world scenarios due to sample inefficiencies of learning and safety constraints. Future of RL depends on our grasping of how humans learn.</p><p>Overall, RL is nothing but learning in dynamic environments. There are many RL algorithms and methods, but I tried to give core definitions and algorithms to let beginners to have idea about it keeping definitions as simple as possible. I hope you enjoyed!</p><p>As an extra, I leave OpenAI’s Hide and Seek simulation with RL.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FkopoLzvh5jY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DkopoLzvh5jY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FkopoLzvh5jY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2659d34fa2e52eefb926f2263be919c5/href">https://medium.com/media/2659d34fa2e52eefb926f2263be919c5/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c20ddc497c9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/a-simple-outline-of-reinforcement-learning-4c20ddc497c9">A Simple Outline of Reinforcement Learning</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>