<?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 Kaushik Dayalan on Medium]]></title>
        <description><![CDATA[Stories by Kaushik Dayalan on Medium]]></description>
        <link>https://medium.com/@Kaushik_Dayalan?source=rss-74e0ece07a96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kHD0ocKlSU26yFVZxK24Pw.jpeg</url>
            <title>Stories by Kaushik Dayalan on Medium</title>
            <link>https://medium.com/@Kaushik_Dayalan?source=rss-74e0ece07a96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 07:19:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Kaushik_Dayalan/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[Bellman Equation, Value Functions: Reinforcement Learning]]></title>
            <link>https://medium.com/@Kaushik_Dayalan/bellman-equation-value-functions-reinforcement-learning-b8a0a1cad84f?source=rss-74e0ece07a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8a0a1cad84f</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[bellman-equation]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[value-function]]></category>
            <dc:creator><![CDATA[Kaushik Dayalan]]></dc:creator>
            <pubDate>Sun, 27 Aug 2023 19:52:57 GMT</pubDate>
            <atom:updated>2023-09-09T21:40:19.682Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y03bol-aq2NalOtk.png" /></figure><p>One of the core concepts of reinforcement learning is the <strong>Bellman Equation</strong> and <strong>Value Functions</strong>. If you are interested in Reinforcement Learning, then the concept of Bellman Equation and Value Functions must become very clear to you. A clear intuition of these concepts will allow you to solve most Reinforcement Learning problems if you have an environment to solve them.</p><p>Before we dive into these concepts, if you are unfamiliar with the components of Reinforcement Learning and Markov Decision Processes(MDPs), I recommend you check out my post on the basics of Reinforcement Learning (<a href="https://medium.com/@Kaushik_Dayalan/reinforcement-learning-for-starters-77565d836014"><strong>Reinforcement Learning for Starters</strong></a>).</p><h4>The Reward Signal</h4><p>As we all know Reinforcement Learning is a reward-based learning system. The agent learns from past experiences of actions and their subsequent rewards. A <strong>reward signal(<em>R</em>) </strong>is scalar feedback from the environment on how well the agent is performing in an environment for a given <strong>state</strong>. An<strong> episode </strong>can be defined as an agent-environment interaction. We seek to maximize the total reward called the <strong>Expected Return</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCOVEEkx2k6QXTho7XT3Tw.png" /><figcaption>(1) The expected Return is represented by Gt</figcaption></figure><p>You can assume (1) is the simplest case representing the total reward as given but this can be suitable for episodic tasks that end at the terminal state. There are situations where there is no terminal state also called continual tasks. You can imagine for such tasks the reward keeps accumulating and as time increases all rewards earned in states would move towards infinity. Thus we introduce a concept of <strong>discounting </strong>also called the discount factor denoted by <strong>gamma</strong>. The discount factor helps you figure out just how valuable the rewards are to the future states.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MZD7o-ViPVisU4ymJD4vlA.png" /><figcaption>(2) The Expected Return Gt is represented along with the discount factor.</figcaption></figure><p>The reward earned k steps in the future is not as valuable as the same reward earned in an earlier state. The discount factor has a range of (0, 1).<br>Setting the discount factor to 0 makes the agent “myopic” where the agent learns to maximize the reward only on the first time step.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ca733b92ba67257c3f514be46413d77/href">https://medium.com/media/3ca733b92ba67257c3f514be46413d77/href</a></iframe><p>The closer the discount factor is to 1 the agent is “farsighted”, the agent takes the importance of more future rewards.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b4ac098925fd936fd86676517d07627/href">https://medium.com/media/5b4ac098925fd936fd86676517d07627/href</a></iframe><h3><strong>The Value Function and </strong>Bellman Equation</h3><p>I believe now you have a strong understanding of the concept of rewards, MDP, and discounting in reinforcement learning. This will help you easily understand the <strong>Value Function</strong>. It is one of the most important components of an RL agent. In simple terms, I can define the Value Function as a performance metric to evaluate how well an agent’s policy performs in an environment and the potential rewards expected to be earned.</p><p>Each state in an environment has a Value Function. The Value Function of a state is the <strong>expected future reward </strong>to be earned from the current state the agent is in until it reaches the terminal state. It can be formulated using the Bellman Equation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*5XQSNV1QMdLc14XAwhgXZw.png" /><figcaption>(3) The Value Function is the expected return Gt(sum of future rewards) of a state <strong>s</strong>.</figcaption></figure><p>This equation is broken down into two parts:</p><ol><li>The reward earned by the agent taking an action in the current state.</li><li>The Value Function of the next state the agent transitions to.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*Qnxi4oTAlnui9VepxpAtmg.png" /><figcaption>(4) Bellman Equation of the Value Function</figcaption></figure><p>The Value Function (4) is represented as the sum of the reward earned after taking an action in state <strong>s </strong>and the Value Function of the next state. (Note: The reward for state <strong>s </strong>at time step <strong>t</strong> is represented as <strong>R</strong> with a time step <strong>t+1</strong> because the agent earns the reward only after it has taken an action in state <strong>s </strong>and transitioned to the next state.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*xHfh8NYu1CfHO1lvXoiz1g.png" /><figcaption>(5) Intuition in using the Value Function of the next state to calculate the value function of the current state</figcaption></figure><p>The reason behind using the Value Function of the next state is simple, it represents the sum of returns Gt earned by the agent being in state <strong>s</strong> at time step <strong>t+1</strong> until the terminal state. It can be represented as given in (4).</p><p>Now you must be thinking, the Value Function provides us an estimate of the rewards earned in a state and an agent’s performance but no action-specific information. This is where the <strong>Action-Value Function</strong> of a state comes into play.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nx_QzuqbRmEyknb1MKy4qg.png" /><figcaption>(6) Bellman Equation of the Action-Value Function</figcaption></figure><p>Instead of having a single Value Function for each state, with the concept of Action-Value Function, each state has a separate Value Function for every possible action in a given state.</p><p>If you got the intuition of a Value Function which is the expected future reward of a state. Then I would urge you to think about what an Action-Value Function would represent. <strong>It is the expected future reward that can be earned given a certain action the agent takes in a state</strong>. I can also easily give a high-level overview of how an agent would learn by saying that if we are able to compute the Action-Value Function of a state then generally the best action possible in a state will be the one with the highest Action-Value Function.</p><h3>In Conclusion</h3><p>I know that you would have a clear grasp of the topics we discussed in the post.</p><ol><li>The<strong> Reward Signal</strong> and how it can be calculated.</li><li>The <strong>Bellman Equation</strong> and how it presents us with the <strong>Value Function</strong>.</li><li>The <strong>Action-Value Function</strong> that can be derived from the Value Function and how it is different from the Value Function.</li></ol><p>I will be posting more content on reinforcement learning algorithms and techniques. Keep an eye out for more, and don’t forget to follow! Looking forward to having you with me in my next post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8a0a1cad84f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reinforcement Learning for Starters]]></title>
            <link>https://medium.com/@Kaushik_Dayalan/reinforcement-learning-for-starters-77565d836014?source=rss-74e0ece07a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/77565d836014</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[markov-chains]]></category>
            <category><![CDATA[markov-decision-process]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Kaushik Dayalan]]></dc:creator>
            <pubDate>Sun, 13 Aug 2023 03:37:28 GMT</pubDate>
            <atom:updated>2023-08-13T03:37:28.860Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Reinforcement Learning(RL)</strong> is a beautiful topic in machine learning, not only in terms of AI. It solves problems similarly to how humans would, where we take every day at a time to learn and become better in life.</p><h3>Introduction</h3><p>As a beginner, when I started to dive into RL it took me some time to understand what happens under the hood as it tends to be different compared to traditional machine learning techniques. This post will help you understand the components of an RL algorithm and how we can put them to use to solve an RL problem.</p><p>An RL problem consists of an <strong>agent</strong> and an <strong>environment</strong>. The agent has a <strong>set of actions</strong> to choose from. The agent interacts with the environment by selecting actions. The designed environment must provide feedback for actions taken within it. This feedback can be called a <strong>reward</strong>, which can be either positive or negative depending on whether the action selected is good or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VXHAuJz9WBq1Yck6Lenx5w.png" /><figcaption>A simple RL problem can be represented as shown in this figure. The agent has a set of actions by which it can move within an environment. The environment is a simple maze with a single entry and exit, and the reward is located at the exit. The goal of the agent is to find its way to the gold and earn rewards. The agent can then learn from past experiences in the environment to get better at finding gold.</figcaption></figure><p>As the agent accumulates experiences and rewards from the environment, it gradually learns to act in a greedily based on the rewards earned. This enables it to select the optimal actions that yield the maximum reward within the environment.</p><h3>Components of Reinforcement Learning</h3><p>Now, let’s comprehend the various components that can aid us in formulating and resolving a reinforcement learning problem.</p><ol><li>Reward: A reward(<em>R</em>) can be represented as scalar feedback from the environment on how well the agent is performing in an environment for a given time step.</li><li>State: The state (S) provides information about where the agent is in the environment.</li><li>The action set: Set of actions (A) that the agent can choose from.</li><li>Policy: It holds the behavior of the agent. It maps action to state.</li><li>Value function: It is a prediction of future expected rewards to be earned given that the agent is in a state. Can be used to evaluate how good or bad a state is.</li><li>Agent: A function or class that can choose actions to take in the environment. It consists of the policy and an RL algorithm to learn from past experiences.</li><li>Environment: A function or class that can take input the action of an agent and perform the computation of the problem to solve and return a reward.</li></ol><h3>Finite Markov Decision Process</h3><p>Once you possess a solid comprehension of the components of Reinforcement Learning, you can commence learning about Markov Decision Processes, commonly referred to as MDPs. MDPs serve as the foundational building block for structuring an RL problem.</p><p>In an environment, all states <strong><em>S</em></strong> are required to adhere to the <strong>Markov Property</strong>. A state <strong><em>S</em></strong> is considered <strong>Markov</strong> if the action taken within state <strong><em>S</em></strong> depends exclusively on the present state <strong><em>S </em></strong>as well as the anticipated future state and the expected reward to be attained and not the states visited in the past. A collection of such states is called a <strong>Markov Process.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/0*hVjImW-ildVxKXYz.png" /><figcaption>Markov Property</figcaption></figure><p>The entire process involves the agent traversing through different states, with all the states of the environment adhering to the <strong>Markov Property</strong>. This process is termed a <strong>Markov Decision Process</strong>. A <strong>finite MDP</strong> holds significance in formulating and comprehending nearly 90% of reinforcement learning problems. It can be defined as follows: given a finite set of states <em>S</em> within an environment and actions <em>A</em>, a specific probability exists for each step taken in the environment from state <strong><em>S</em>(<em>t</em>)</strong> to <strong><em>S</em>(<em>t</em>+1)</strong> while executing action <strong><em>A</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/0*lk5m1rEaSwjF0-vu.png" /><figcaption>Finite Markov Decision Process</figcaption></figure><h3>Simple Example of an MDP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XP6jHsDFr2m3eOlZb7KDBA.png" /><figcaption>A day in the life of an IT Employee can be represented as a simple MDP with different states that are visited by the employee with the transition probability for each state in black and the rewards in red.</figcaption></figure><p>I always understand concepts better with examples. If you are like me, then this straightforward example can provide insight into how a basic MDP can be derived from our daily experiences. Envision yourself as an IT employee who begins the day by working at the office. After completing your shift, you’re faced with a decision: you can either head to the gym or go out to socialize and party. Once you finish working out in the gym you would have the motivation to eat healthy and get a good night’s sleep. After partying you would have the choice to eat unhealthy or healthy food. All the different situations (states) the employee visited can be assigned a probability and a reward. Let’s derive some Markov Processes from this simple MDP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0xuXs2enPjrNAWX9a16mVg.png" /><figcaption>Markov Processes from the above MDP</figcaption></figure><p>By considering various transition probabilities, we can construct specific Markov Processes that start from the “work” state and end in the “sleep” state. During this process, we can add up the total rewards. Almost immediately, we gain an understanding of how the employee is rewarded within distinct states and which subsequent states lead to greater earned rewards. By acting greedily on such rewards the employee can learn to earn the maximum reward in the MDP.</p><h3>In Conclusion</h3><p>Today, we learned about the basics of Reinforcement Learning and its various components:</p><ul><li>We had a brief introduction to how an agent engages with an environment and acquires rewards.</li><li>Explored the fundamental elements of Reinforcement Learning, including state, reward signal, action set, policy, agent, and environment.</li><li>Explored the process of formulating a Reinforcement Learning problem using the Markov Decision Process.</li><li>Created a basic MDP example from daily life to comprehend the Markov Decision Process concept.</li></ul><p>I hope I was able to provide a good intuition and understanding how reinforcement learning works. I will be posting more content on reinforcement learning algorithms and techniques. Keep an eye out for more, and don’t forget to follow! Looking forward to having you with me in my next post.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77565d836014" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>