{"id":846,"date":"2019-01-09T09:14:16","date_gmt":"2019-01-09T09:14:16","guid":{"rendered":"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=846"},"modified":"2019-01-09T09:48:35","modified_gmt":"2019-01-09T09:48:35","slug":"basics-of-reinforcement-learning-i","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/chapter\/basics-of-reinforcement-learning-i\/","title":{"rendered":"Basics of Reinforcement Learning-I"},"content":{"raw":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/bjMmgVEuhxE\" target=\"_blank\" rel=\"noopener\"><img src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a>\r\n<\/span><\/div>\r\n\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>Learning Objectives<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe learning objectives of the module are as follows:\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A Basic Introduction to Reinforcement Learning\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 To explain the Elements of Reinforcement Learning\r\n\r\n\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 To discuss the applications of ReinforcementLearning\r\n\r\n&nbsp;\r\n\r\n<strong>37.1\u00a0 Reinforcement learning<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Reinforcement learning is the problem of getting an agent to act in the world so as to maximize its rewards. For example, consider teaching a monkey a new trick: you cannot instruct the monkey what is to be done, but you can reward (a banana) or punish (scold) it depending on whether it does the right\/wrong thing. Here the monkey has to figure out what it did that made it get the reward or punishment, which is known in reinforcement learning context as the credit assignment problem. Learningtakesplaceasa resultofinteraction between an agentand the world. In other words percept received by an agent should be used not only for understanding, interpreting or prediction, as in the machine learning tasks we have discussed so far, butalsoforacting. Reinforcement learning is more general than supervised and unsupervised learning and learn from interaction with the environment to achieve a goal and getting an agent to act in the world so as to maximize its rewards. It allows agents to automatically determine the ideal behaviour within a specific context, in order to maximize its performance. Simple reward feedback is required for the agent to learn its behaviour; this is known as the reinforcement signal.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The motivation behind reinforcement learning is that it allows an agent to learn its behavior based on feedback from the environment. This behavior can be learnt once and for all, or keep on adapting as time goes by. If the problem is modelled with care, some reinforcement learning algorithms can converge to the global optimum; this is the ideal behavior that maximizes the reward.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"font-size: 1em;text-align: initial\">It is a trial-and-error learning paradigm which learns from rewards and punishments. Reinforcement learning is not just an algorithm but a new paradigm in itself. Its objective is to learn about a system from minimal feedbacklike its behavior, control. It is inspired by behavioral psychology.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-849\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252.png\" alt=\"\" width=\"433\" height=\"258\" \/>\r\n<p style=\"text-align: center\"><strong>Figure: 37.1<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">As mentioned in figure 37.1, the reinforcement learning consists of the agent and the environment. The agent performs the action under the policy being followed and the environment is everything else other than the agent. Reinforcement learning is learning from interaction and it is a goal-oriented learning. It is learning about, from, and while interacting with an external environment. It is a learning which tells you, what to do (what action to take), how to map situations to actions so as to maximize a numerical reward signal.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The general definition of reinforcement learning is as follows \"Reinforcement learning is learning what to do \u2014 how to map situations to actions \u2014 so as to maximize a numerical reward signal. The learner is not told which actions to take, as in most forms of machine learning, but instead must discover which actions yield the most reward by trying them.\"<\/p>\r\n&nbsp;\r\n\r\n<strong>37.2 Difference<\/strong> <strong>between Reinforcement, Supervised and Unsupervised learning<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In supervised learning, the training information contains the desired (target) outputs. In reinforcement learning the training information contains evaluations (\u201crewards\u201d \/ \u201cpenalties\u201d) and the output are actions of the agent (Figure 37.2). In supervised learning we get the target output and if we subtract the actual output from the target output we will get the error of the system but that is not the case with reinforcement learning. In reinforcement learning the objective is to get as much reward as possible.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong style=\"text-align: initial;font-size: 1em\">37.2.1 Supervised Learning<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"font-size: 1em\">In supervised learning we have a situation in which sample (input, output) pairs of the function to be learned can be perceived or are given. We can think as if there is a kind teacher who makes training data: (X,Y). (features, label) available and the job of the learning system is to predict Y, minimizing some loss.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-851\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253.png\" alt=\"\" width=\"613\" height=\"178\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 37.2 Comparison Of Supervised Learning and Reinforcement Learning 37.2.2 Unsupervised Learning<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">In unsupervised learning the training data contains X ( the features only) and the job of the learning system is to find \u201csimilar\u201d points in high-dimensional X-space.<\/p>\r\n&nbsp;\r\n\r\n<strong>37.2.3 Reinforcement Learning<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In reinforcement learning the agent acts on its environment, it receives some evaluation of its action (reinforcement), but is not told of which actionisthecorrectonetoachieveitsgoal. The training data: (S, A, R). (State-Action-Reward) and the learning system needs to develop an optimal policy(sequence of decision rules) so as to maximize its long-term reward.<\/p>\r\n&nbsp;\r\n\r\n<strong>37.3\u00a0 General Reinforcement Learning Algorithm<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The first step is to initialise the learner\u2019s internal state . Then the algorithm should repeat forever the following steps<\/p>\r\n&nbsp;\r\n\r\n1.Observe current state <em>s<\/em>\r\n\r\n&nbsp;\r\n\r\n2.Choose action <em>a<\/em> using some evaluation function\r\n\r\n&nbsp;\r\n\r\n3.Execute action <em>a<\/em>\r\n\r\n&nbsp;\r\n\r\n4.\u00a0 Let <em>r<\/em> be immediate reward, <em>s\u2019<\/em> new state 5.Update internal state based on <em>s,a,r,s\u2019.<\/em>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Here learning is concerned with what to do that is how to map situations to actionsso as to maximize a numerical reward signal. Therefore learning to choose an action based on an evaluation function is the learning part.<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>37.4 Key Features of Reinforcement Learning<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The following are the key features of reinforcement learning. The learner is not told which actions to take and in that sense it is a trial-and-error search. It has the possibility of delayed reward (sacrifice short-term gains for greater long -term gains). In reinforcement learning there is a need to explore and exploit. It considers the whole problem of a goal-directed agent interacting with an uncertain environment. The reinforcement model assumes that each percept(<em>e<\/em>) is enough to determine the State(the state is accessible) and the agent can decompose the Reward component from a percept. Therefore the agent task: to find a optimal policy, mapping states to actions, that maximize long-run measure of the reinforcement.<\/p>\r\n&nbsp;\r\n\r\n<strong>37.5 Agent-Environment Interface<\/strong>\r\n\r\n<img class=\"aligncenter size-full wp-image-852\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254.png\" alt=\"\" width=\"602\" height=\"268\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 37.3 Agent-Environment Interface<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">We have the agentenvironment interface as shown in Figure 37.3. Associated with this interface is <strong>s<\/strong><strong>t<\/strong> which is the state at time t, <strong>r<\/strong><strong>t<\/strong>which is the reward by the environment to the agent at time t and <strong>a<\/strong><strong>t<\/strong> which is the action taken by the agent at time t. After taking the action at time t, the environment goes to the next state <strong>s<\/strong><strong>t+1<\/strong> at time t+1, and gives the reward <strong>r<\/strong><strong>t+1<\/strong>at time t+1.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The task of reinforcement learning is to learn how to behave successfully so as to achieve a goal while interacting with an external environment and learn through experience from trial and error. Some examples of reinforcement learning are:<\/p>\r\n&nbsp;\r\n<ul>\r\n \t<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Game playing: The agent knows it has won or lost, but it doesn\u2019t know the appropriate action in each state<\/span><\/li>\r\n \t<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Control: a traffic system can measure the delay of cars<\/span><\/li>\r\n<\/ul>\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>37.6 Elements of Reinforcement Learning<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe elements of reinforcement learning are shown in Figure 37.4. They are:\r\n<ol>\r\n \t<li>Policy: what to do<\/li>\r\n \t<li style=\"text-align: justify\">Reward: what is good- defines the goal in a reinforcement learning problem and gives the agent a sense of what is good in an immediate sense<\/li>\r\n \t<li style=\"text-align: justify\">Value: what is good because it predicts reward -The value of a state is the total amount of reward an agent can expect to accumulate over the future, starting from that state in other words gives the agent a sense of what is good in the long run.<\/li>\r\n \t<li style=\"text-align: justify\">Model: what follows what -used to predict the states the environment will be in after the agent performs its actions- the agent often uses the model to compute series of potential state\u2013action sequences<\/li>\r\n<\/ol>\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-853\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255.png\" alt=\"\" width=\"697\" height=\"529\" \/>\r\n<p style=\"text-align: justify\">We have the environment and a state given to the agent. The agent does an action based on the policy. The action effects the environment. The environment moves to another state and gives you a reward. Figure 37.5shows this transition model, (i.e.) how action influence states. Given the state and the action, we have the reward R, the immediate value of state -action transition and we have the policyp which maps states to actions.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Let us take an example shown in Figure 37.6, which has the immediate reward values and we explain about the value function for this example. In the figure, the immediate reward values are the numbers like 90, 100. They are the reward given to the action chosen by the agent. The actions of the agent are indicated by different arrows namely upward, downward, left, right. The Figure shows us the environment, the agent is acting upon. Initially we assume that all states have values of 0 except move up from state f to c to goal and stateb to c which have value 100 where we assume c is the goal. Now in the next step assuming that discount factor g= 0.9 we can calculate value function of state from and to states a and c as 90 and to and from state d as 81 using equation given.<\/p>\r\n<img class=\"aligncenter size-full wp-image-854\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256.png\" alt=\"\" width=\"621\" height=\"276\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 37.6<\/strong><\/p>\r\nThe equation for the value function is given below. It maps the states to state values.\r\n\r\n<img class=\"aligncenter size-full wp-image-855\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257.png\" alt=\"\" width=\"577\" height=\"55\" \/>\r\n\r\nFor each action, we go to a different state and the environment gives reward. This gets added up for each action, until we reach the final position.\r\n\r\n&nbsp;\r\n\r\n<strong>37.7 Reinforcement model<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">In the reinforcement model, each percept (e) is enough to determine the State (the state is accessible). The agent can decompose the Reward component from a percept. The agent task is to find an optimal policy, mapping states to actions that maximize long-run measure of the reinforcement. We can think of reinforcement in terms of reward that the agent gets. It can be modeled as MDP <\/span><strong style=\"text-align: initial;font-size: 1em\">(Markov Decision<\/strong> <strong style=\"text-align: initial;font-size: 1em\">Process) <\/strong><span style=\"text-align: initial;font-size: 1em\">model.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>37.7.1\u00a0 Review of MDP model<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In Markov Decision Process the transitions are probabilistic and the observation = state. The assumption is that reward and next state are (probabilistic) functions of current observation and action only. The goal is to learn a good strategy for collecting reward, rather than necessarily to make a model.Markov Decision Process model consists of four components namely S, T, A and R. Here S is the set of states; A is the set of actions; T is the probability of transition from s to s\u2019 given action a and is written as T(s,a,s\u2019) = P(s\u2019|s,a).<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-856\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258.png\" alt=\"\" width=\"627\" height=\"485\" \/>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The reinforcement learning framework tells about how to learn from close interaction in a stochastic environment. It gives anoisy delayed scalar evaluation and itmaximizes the long term performance of the system.<\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n<strong>37.7 Elements of Reinforcement Learning (Markov Decision Process)<\/strong>\r\n\r\n&nbsp;\r\n\r\nFrom MDP model view point, the elements of reinforcement learning can be stated as follows,\r\n\r\n&nbsp;\r\n\r\n<em>s<\/em><sub><em>t<\/em><\/sub> : State of agent at time t\r\n\r\n&nbsp;\r\n\r\n<em>a<\/em><sub><em>t<\/em><\/sub> : Action taken at time t\r\n\r\n&nbsp;\r\n\r\nIn <em>s<\/em><sub><em>t<\/em><\/sub> ,action<em>a<\/em><em>t<\/em>is taken and the clock ticks. Then the reward <em>r<\/em><em>t<\/em>+1 is received and state changes to <em>s<\/em><em>t<\/em>+1.\r\n\r\n&nbsp;\r\n\r\nThe Next state probability is given by P (<em>s<\/em><em>t<\/em>+1| <em>s<\/em><em>t<\/em> , <em>a<\/em><em>t<\/em> ) given current state and current action\r\n\r\n&nbsp;\r\n\r\nReward probability is given by p (<em>r<\/em><em>t<\/em>+1 | <em>s<\/em><em>t<\/em> , <em>a<\/em><em>t<\/em> )\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">\u00a0The Initial state(s) and the goal state(s) will be known and we have an episode which is the trial of actions from initial state to goal state.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">As we have already discussed reinforcement learning is not a supervised learning. We have a very sparse \u201csupervision\u201d as the target output is not provided. We do not have the error gradient information available as with the supervised learning. Here the action chooses the next state and we explore to estimate the gradient through trial and error learning.Pattern detection is not the primary goal of reinforcement learning.<\/p>\r\n&nbsp;\r\n\r\n<strong>37.8<\/strong>\u00a0\u00a0\u00a0\u00a0 <strong>The Gambling example<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In this example, we toss 3 different biased coins. The coin to be tossed is selected randomly from the three options and we always see which coin we are going to play next. We make bets on head or tail and the wage is always $1. If we win we get $1, otherwise we lose our bet. The reinforcement model for this example is<\/p>\r\n&nbsp;\r\n\r\n<strong>Input: <\/strong>X \u2013 a coin chosen for the next toss,\r\n\r\n&nbsp;\r\n\r\n<strong>Action: <\/strong>A \u2013 choice of head or tail,\r\n\r\n&nbsp;\r\n\r\n<strong>Reinforcements: <\/strong>{1, -1}\r\n\r\n<img class=\"aligncenter size-full wp-image-857\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259.png\" alt=\"\" width=\"495\" height=\"121\" \/>\r\n\r\n&nbsp;\r\n\r\nThe learning goal for the example is given below.\r\n\r\n<\/div>\r\n<div>\r\n\r\n<img class=\"aligncenter size-full wp-image-858\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260.png\" alt=\"\" width=\"586\" height=\"167\" \/>\r\n<p style=\"text-align: justify\">The example has been taken from Artificial Intelligence: A Modern Approach Russell and Norvig<\/p>\r\n&nbsp;\r\n\r\n&nbsp;\r\n\r\n<strong>37.9Model based and model free approach of reinforcement learning<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the model based approach, we learn the model and use it to derive the optimal policy. Example is the Adaptive dynamic learning (ADP) approach. In the model free approach we derive the optimal policy without learning the model. Examples include LMS and Temporal difference approach<\/p>\r\n&nbsp;\r\n\r\n<strong>37.10Applications of Reinforcement Learning<\/strong>\r\n\r\n&nbsp;\r\n\r\nRobot navigation\r\n\r\n&nbsp;\r\n\r\nAdaptive control\r\n\r\n&nbsp;\r\n\r\ne.g. Helicopter pilot!\r\n\r\n&nbsp;\r\n\r\nCombinatorial optimization\r\n\r\n&nbsp;\r\n\r\ne.g. VLSI placement and routing , elevator dispatching\r\n\r\n&nbsp;\r\n\r\nGame playing\r\n\r\n&nbsp;\r\n\r\ne.g. Backgammon \u2013 world\u2019s best player!\r\n\r\n&nbsp;\r\n\r\nComputational Neuroscience\r\n\r\n&nbsp;\r\n\r\ne.g. Modeling of reward processes\r\n\r\n&nbsp;\r\n\r\n<strong>TD-Gammon<\/strong>: Tesauro\r\n\r\n&nbsp;\r\n\r\n\u2013\u00a0 world\u2019s best backgammon program\r\n\r\n&nbsp;\r\n\r\n<strong>Elevator Control<\/strong>: Crites &amp;Barto\r\n\r\n&nbsp;\r\n\r\n\u2013\u00a0 high performance down-peak elevator controller\r\n\r\n&nbsp;\r\n\r\n<strong style=\"text-align: initial;font-size: 1em\">Dynamic Channel Assignment<\/strong><span style=\"text-align: initial;font-size: 1em\">: Singh &amp;Bertsekas, Nie&amp;Haykin<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n\u2013 high performance assignment of radio channels to mobile telephone calls\r\n\r\n&nbsp;\r\n\r\n<strong>37.13 Robot in a Room Example<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">We take an example of robot in a room that has starting position as given in Figure 37.7. The actions that can be taken by the agent are UP, DOWN, LEFT, RIGHT. In this example we bring in the probability of each action. The agent moves UP 80% of time,moves LEFT 10% of time, moves RIGHT 10% of time. We are given the information that the reward is<strong>+1 at [4,3], -1 at [4,2].<\/strong>The reward for each step is - 0.04. We have to find the strategy to achieve the max reward.<\/p>\r\n<img class=\"aligncenter size-full wp-image-859\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-261.png\" alt=\"\" width=\"279\" height=\"201\" \/>\r\n<p style=\"text-align: center\"><strong>Figure 37.7 Starting Board Position<\/strong><\/p>\r\n<strong>Optimal Policy Solution<\/strong>\r\n\r\n&nbsp;\r\n\r\n<img class=\"aligncenter size-full wp-image-860\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262.png\" alt=\"\" width=\"415\" height=\"224\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 37.8<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">Optimal policy solution for the given robot example is shown in figure 37.8. Solution when the reward for each step is -2, -0.1 and -0.04 is given in Figure 37.9. The solutions when the reward for each step is -0.01 and +0.01 is given in Figure 37.10.<\/p>\r\n\r\n<\/div>\r\n<img class=\"aligncenter size-full wp-image-861\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263.png\" alt=\"\" width=\"625\" height=\"398\" \/>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">As we can see from the example, when we change the policy in the environment, the optimal solution changes. It also effects the way the agent takes the action in each state.<\/p>\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n<ul>\r\n \t<li>Outlined the key features of Reinforcement Learning<\/li>\r\n \t<li>Explained the elements &amp; models of Reinforcement Learning.<\/li>\r\n \t<li>Reviewed the MDP model<\/li>\r\n \t<li>Discussed some applications of RL<\/li>\r\n<\/ul>\r\n&nbsp;\r\n<table>\r\n<tbody>\r\n<tr>\r\n<td><strong>you can view video on Basics of Reinforcement Learning-I<\/strong><\/td>\r\n<td><a href=\"https:\/\/youtu.be\/bjMmgVEuhxE\" target=\"_blank\" rel=\"noopener\"><img class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\r\n<\/tr>\r\n<\/tbody>\r\n<\/table>\r\n\r\n<strong>Web Links<\/strong>\r\n\r\n&nbsp;\r\n<ul>\r\n \t<li>http:\/\/en.wikipedia.org\/wiki\/Reinforcement_learning<\/li>\r\n \t<li>http:\/\/www.cs.cmu.edu\/afs\/cs\/project\/theo-20\/www\/mlbook\/ch13.pdf<\/li>\r\n \t<li>http:\/\/neuro.bstu.by\/ai\/RL-3.pdf<\/li>\r\n \t<li>https:\/\/cs.uwaterloo.ca\/~ppoupart\/ICML-07-tutorial-slides\/icml07-brl-tutorial-part2-intro-ghavamzadeh.pdf<\/li>\r\n \t<li>ce.sharif.edu\/courses\/91-92\/1\/ce717-2\/resources\/root\/Lectures\/RL.pdf<\/li>\r\n \t<li>www.cogsys.wiai.uni-bamberg.de\/teaching\/ss05\/ml\/slides\/cogsysII-10.pdf<\/li>\r\n \t<li>https:\/\/www.cs.uic.edu\/~piotr\/cs594\/YijueRL.ppt<\/li>\r\n \t<li>www.cs.berkeley.edu\/~jordan\/MLShortCourse\/reinforcement-learning.ppt<\/li>\r\n<\/ul>\r\n<strong>Supporting &amp; Reference Materials<\/strong>\r\n<ul>\r\n \t<li>Richard S. Sutton and Andrew G. Barto, \u201cReinforcement Learning:An Introduction\u201d, 1998, MIT press<\/li>\r\n \t<li>Wiering, Marco, van Otterlo, Martijn (Eds.), \u201cReinforcement Learning\u201d, State-of-the-ArtSeries: Adaptation, Learning, and Optimization, Vol. 12 , 2012<\/li>\r\n \t<li>Stuart Russell and Peter Norvig \u201cArtificial Intelligence: A Modern Approach Prentice Hall Series in Artificial Intelligence), 2009<\/li>\r\n \t<li>Tom Mitchell, \u201cMachine Learning\u201d,McGraw-Hill Education, 1997<\/li>\r\n \t<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Alpaydin+Ethem&amp;search-alias=stripbooks\">AlpaydinEthem, <\/a>\u201cIntroduction to Machine Learning\u201d, The MIT Press; third edition, 2014<\/li>\r\n \t<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Stephen+Marsland&amp;search-alias=stripbooks\">Stephen Marsland, <\/a>\u201cMachine Learning: An Algorithmic Perspective\u201d, Chapman and Hall\/CRC; 2 edition, 2014<\/li>\r\n<\/ul>","rendered":"<div><span style=\"float: right\"><a href=\"https:\/\/youtu.be\/bjMmgVEuhxE\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"epgp books\" width=\"75px\" height=\"75px;\" \/><\/a><br \/>\n<\/span><\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>Learning Objectives<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The learning objectives of the module are as follows:<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 A Basic Introduction to Reinforcement Learning<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 To explain the Elements of Reinforcement Learning<\/p>\n<p>\u2022\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 To discuss the applications of ReinforcementLearning<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.1\u00a0 Reinforcement learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Reinforcement learning is the problem of getting an agent to act in the world so as to maximize its rewards. For example, consider teaching a monkey a new trick: you cannot instruct the monkey what is to be done, but you can reward (a banana) or punish (scold) it depending on whether it does the right\/wrong thing. Here the monkey has to figure out what it did that made it get the reward or punishment, which is known in reinforcement learning context as the credit assignment problem. Learningtakesplaceasa resultofinteraction between an agentand the world. In other words percept received by an agent should be used not only for understanding, interpreting or prediction, as in the machine learning tasks we have discussed so far, butalsoforacting. Reinforcement learning is more general than supervised and unsupervised learning and learn from interaction with the environment to achieve a goal and getting an agent to act in the world so as to maximize its rewards. It allows agents to automatically determine the ideal behaviour within a specific context, in order to maximize its performance. Simple reward feedback is required for the agent to learn its behaviour; this is known as the reinforcement signal.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The motivation behind reinforcement learning is that it allows an agent to learn its behavior based on feedback from the environment. This behavior can be learnt once and for all, or keep on adapting as time goes by. If the problem is modelled with care, some reinforcement learning algorithms can converge to the global optimum; this is the ideal behavior that maximizes the reward.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"font-size: 1em;text-align: initial\">It is a trial-and-error learning paradigm which learns from rewards and punishments. Reinforcement learning is not just an algorithm but a new paradigm in itself. Its objective is to learn about a system from minimal feedbacklike its behavior, control. It is inspired by behavioral psychology.<\/span><\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-849\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252.png\" alt=\"\" width=\"433\" height=\"258\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252.png 433w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252-300x179.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252-65x39.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252-225x134.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-252-350x209.png 350w\" sizes=\"auto, (max-width: 433px) 100vw, 433px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure: 37.1<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">As mentioned in figure 37.1, the reinforcement learning consists of the agent and the environment. The agent performs the action under the policy being followed and the environment is everything else other than the agent. Reinforcement learning is learning from interaction and it is a goal-oriented learning. It is learning about, from, and while interacting with an external environment. It is a learning which tells you, what to do (what action to take), how to map situations to actions so as to maximize a numerical reward signal.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The general definition of reinforcement learning is as follows &#8220;Reinforcement learning is learning what to do \u2014 how to map situations to actions \u2014 so as to maximize a numerical reward signal. The learner is not told which actions to take, as in most forms of machine learning, but instead must discover which actions yield the most reward by trying them.&#8221;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.2 Difference<\/strong> <strong>between Reinforcement, Supervised and Unsupervised learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In supervised learning, the training information contains the desired (target) outputs. In reinforcement learning the training information contains evaluations (\u201crewards\u201d \/ \u201cpenalties\u201d) and the output are actions of the agent (Figure 37.2). In supervised learning we get the target output and if we subtract the actual output from the target output we will get the error of the system but that is not the case with reinforcement learning. In reinforcement learning the objective is to get as much reward as possible.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong style=\"text-align: initial;font-size: 1em\">37.2.1 Supervised Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"font-size: 1em\">In supervised learning we have a situation in which sample (input, output) pairs of the function to be learned can be perceived or are given. We can think as if there is a kind teacher who makes training data: (X,Y). (features, label) available and the job of the learning system is to predict Y, minimizing some loss.<\/span><\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-851\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253.png\" alt=\"\" width=\"613\" height=\"178\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253.png 613w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253-300x87.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253-65x19.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253-225x65.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-253-350x102.png 350w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 37.2 Comparison Of Supervised Learning and Reinforcement Learning 37.2.2 Unsupervised Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In unsupervised learning the training data contains X ( the features only) and the job of the learning system is to find \u201csimilar\u201d points in high-dimensional X-space.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.2.3 Reinforcement Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In reinforcement learning the agent acts on its environment, it receives some evaluation of its action (reinforcement), but is not told of which actionisthecorrectonetoachieveitsgoal. The training data: (S, A, R). (State-Action-Reward) and the learning system needs to develop an optimal policy(sequence of decision rules) so as to maximize its long-term reward.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.3\u00a0 General Reinforcement Learning Algorithm<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The first step is to initialise the learner\u2019s internal state . Then the algorithm should repeat forever the following steps<\/p>\n<p>&nbsp;<\/p>\n<p>1.Observe current state <em>s<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>2.Choose action <em>a<\/em> using some evaluation function<\/p>\n<p>&nbsp;<\/p>\n<p>3.Execute action <em>a<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>4.\u00a0 Let <em>r<\/em> be immediate reward, <em>s\u2019<\/em> new state 5.Update internal state based on <em>s,a,r,s\u2019.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Here learning is concerned with what to do that is how to map situations to actionsso as to maximize a numerical reward signal. Therefore learning to choose an action based on an evaluation function is the learning part.<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>37.4 Key Features of Reinforcement Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The following are the key features of reinforcement learning. The learner is not told which actions to take and in that sense it is a trial-and-error search. It has the possibility of delayed reward (sacrifice short-term gains for greater long -term gains). In reinforcement learning there is a need to explore and exploit. It considers the whole problem of a goal-directed agent interacting with an uncertain environment. The reinforcement model assumes that each percept(<em>e<\/em>) is enough to determine the State(the state is accessible) and the agent can decompose the Reward component from a percept. Therefore the agent task: to find a optimal policy, mapping states to actions, that maximize long-run measure of the reinforcement.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.5 Agent-Environment Interface<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-852\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254.png\" alt=\"\" width=\"602\" height=\"268\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254.png 602w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254-300x134.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254-65x29.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254-225x100.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-254-350x156.png 350w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 37.3 Agent-Environment Interface<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We have the agentenvironment interface as shown in Figure 37.3. Associated with this interface is <strong>s<\/strong><strong>t<\/strong> which is the state at time t, <strong>r<\/strong><strong>t<\/strong>which is the reward by the environment to the agent at time t and <strong>a<\/strong><strong>t<\/strong> which is the action taken by the agent at time t. After taking the action at time t, the environment goes to the next state <strong>s<\/strong><strong>t+1<\/strong> at time t+1, and gives the reward <strong>r<\/strong><strong>t+1<\/strong>at time t+1.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The task of reinforcement learning is to learn how to behave successfully so as to achieve a goal while interacting with an external environment and learn through experience from trial and error. Some examples of reinforcement learning are:<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Game playing: The agent knows it has won or lost, but it doesn\u2019t know the appropriate action in each state<\/span><\/li>\n<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Control: a traffic system can measure the delay of cars<\/span><\/li>\n<\/ul>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>37.6 Elements of Reinforcement Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The elements of reinforcement learning are shown in Figure 37.4. They are:<\/p>\n<ol>\n<li>Policy: what to do<\/li>\n<li style=\"text-align: justify\">Reward: what is good- defines the goal in a reinforcement learning problem and gives the agent a sense of what is good in an immediate sense<\/li>\n<li style=\"text-align: justify\">Value: what is good because it predicts reward -The value of a state is the total amount of reward an agent can expect to accumulate over the future, starting from that state in other words gives the agent a sense of what is good in the long run.<\/li>\n<li style=\"text-align: justify\">Model: what follows what -used to predict the states the environment will be in after the agent performs its actions- the agent often uses the model to compute series of potential state\u2013action sequences<\/li>\n<\/ol>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-853\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255.png\" alt=\"\" width=\"697\" height=\"529\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255.png 697w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255-300x228.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255-65x49.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255-225x171.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-255-350x266.png 350w\" sizes=\"auto, (max-width: 697px) 100vw, 697px\" \/><\/p>\n<p style=\"text-align: justify\">We have the environment and a state given to the agent. The agent does an action based on the policy. The action effects the environment. The environment moves to another state and gives you a reward. Figure 37.5shows this transition model, (i.e.) how action influence states. Given the state and the action, we have the reward R, the immediate value of state -action transition and we have the policyp which maps states to actions.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Let us take an example shown in Figure 37.6, which has the immediate reward values and we explain about the value function for this example. In the figure, the immediate reward values are the numbers like 90, 100. They are the reward given to the action chosen by the agent. The actions of the agent are indicated by different arrows namely upward, downward, left, right. The Figure shows us the environment, the agent is acting upon. Initially we assume that all states have values of 0 except move up from state f to c to goal and stateb to c which have value 100 where we assume c is the goal. Now in the next step assuming that discount factor g= 0.9 we can calculate value function of state from and to states a and c as 90 and to and from state d as 81 using equation given.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-854\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256.png\" alt=\"\" width=\"621\" height=\"276\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256.png 621w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256-300x133.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256-65x29.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256-225x100.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-256-350x156.png 350w\" sizes=\"auto, (max-width: 621px) 100vw, 621px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 37.6<\/strong><\/p>\n<p>The equation for the value function is given below. It maps the states to state values.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-855\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257.png\" alt=\"\" width=\"577\" height=\"55\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257.png 577w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257-300x29.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257-65x6.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257-225x21.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-257-350x33.png 350w\" sizes=\"auto, (max-width: 577px) 100vw, 577px\" \/><\/p>\n<p>For each action, we go to a different state and the environment gives reward. This gets added up for each action, until we reach the final position.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.7 Reinforcement model<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">In the reinforcement model, each percept (e) is enough to determine the State (the state is accessible). The agent can decompose the Reward component from a percept. The agent task is to find an optimal policy, mapping states to actions that maximize long-run measure of the reinforcement. We can think of reinforcement in terms of reward that the agent gets. It can be modeled as MDP <\/span><strong style=\"text-align: initial;font-size: 1em\">(Markov Decision<\/strong> <strong style=\"text-align: initial;font-size: 1em\">Process) <\/strong><span style=\"text-align: initial;font-size: 1em\">model.<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>37.7.1\u00a0 Review of MDP model<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In Markov Decision Process the transitions are probabilistic and the observation = state. The assumption is that reward and next state are (probabilistic) functions of current observation and action only. The goal is to learn a good strategy for collecting reward, rather than necessarily to make a model.Markov Decision Process model consists of four components namely S, T, A and R. Here S is the set of states; A is the set of actions; T is the probability of transition from s to s\u2019 given action a and is written as T(s,a,s\u2019) = P(s\u2019|s,a).<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-856\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258.png\" alt=\"\" width=\"627\" height=\"485\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258.png 627w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258-300x232.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258-65x50.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258-225x174.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-258-350x271.png 350w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The reinforcement learning framework tells about how to learn from close interaction in a stochastic environment. It gives anoisy delayed scalar evaluation and itmaximizes the long term performance of the system.<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p><strong>37.7 Elements of Reinforcement Learning (Markov Decision Process)<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>From MDP model view point, the elements of reinforcement learning can be stated as follows,<\/p>\n<p>&nbsp;<\/p>\n<p><em>s<\/em><sub><em>t<\/em><\/sub> : State of agent at time t<\/p>\n<p>&nbsp;<\/p>\n<p><em>a<\/em><sub><em>t<\/em><\/sub> : Action taken at time t<\/p>\n<p>&nbsp;<\/p>\n<p>In <em>s<\/em><sub><em>t<\/em><\/sub> ,action<em>a<\/em><em>t<\/em>is taken and the clock ticks. Then the reward <em>r<\/em><em>t<\/em>+1 is received and state changes to <em>s<\/em><em>t<\/em>+1.<\/p>\n<p>&nbsp;<\/p>\n<p>The Next state probability is given by P (<em>s<\/em><em>t<\/em>+1| <em>s<\/em><em>t<\/em> , <em>a<\/em><em>t<\/em> ) given current state and current action<\/p>\n<p>&nbsp;<\/p>\n<p>Reward probability is given by p (<em>r<\/em><em>t<\/em>+1 | <em>s<\/em><em>t<\/em> , <em>a<\/em><em>t<\/em> )<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">\u00a0The Initial state(s) and the goal state(s) will be known and we have an episode which is the trial of actions from initial state to goal state.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">As we have already discussed reinforcement learning is not a supervised learning. We have a very sparse \u201csupervision\u201d as the target output is not provided. We do not have the error gradient information available as with the supervised learning. Here the action chooses the next state and we explore to estimate the gradient through trial and error learning.Pattern detection is not the primary goal of reinforcement learning.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.8<\/strong>\u00a0\u00a0\u00a0\u00a0 <strong>The Gambling example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In this example, we toss 3 different biased coins. The coin to be tossed is selected randomly from the three options and we always see which coin we are going to play next. We make bets on head or tail and the wage is always $1. If we win we get $1, otherwise we lose our bet. The reinforcement model for this example is<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Input: <\/strong>X \u2013 a coin chosen for the next toss,<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Action: <\/strong>A \u2013 choice of head or tail,<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Reinforcements: <\/strong>{1, -1}<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-857\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259.png\" alt=\"\" width=\"495\" height=\"121\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259.png 495w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259-300x73.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259-65x16.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259-225x55.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-259-350x86.png 350w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The learning goal for the example is given below.<\/p>\n<\/div>\n<div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-858\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260.png\" alt=\"\" width=\"586\" height=\"167\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260.png 586w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260-300x85.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260-65x19.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260-225x64.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-260-350x100.png 350w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/p>\n<p style=\"text-align: justify\">The example has been taken from Artificial Intelligence: A Modern Approach Russell and Norvig<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.9Model based and model free approach of reinforcement learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the model based approach, we learn the model and use it to derive the optimal policy. Example is the Adaptive dynamic learning (ADP) approach. In the model free approach we derive the optimal policy without learning the model. Examples include LMS and Temporal difference approach<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.10Applications of Reinforcement Learning<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Robot navigation<\/p>\n<p>&nbsp;<\/p>\n<p>Adaptive control<\/p>\n<p>&nbsp;<\/p>\n<p>e.g. Helicopter pilot!<\/p>\n<p>&nbsp;<\/p>\n<p>Combinatorial optimization<\/p>\n<p>&nbsp;<\/p>\n<p>e.g. VLSI placement and routing , elevator dispatching<\/p>\n<p>&nbsp;<\/p>\n<p>Game playing<\/p>\n<p>&nbsp;<\/p>\n<p>e.g. Backgammon \u2013 world\u2019s best player!<\/p>\n<p>&nbsp;<\/p>\n<p>Computational Neuroscience<\/p>\n<p>&nbsp;<\/p>\n<p>e.g. Modeling of reward processes<\/p>\n<p>&nbsp;<\/p>\n<p><strong>TD-Gammon<\/strong>: Tesauro<\/p>\n<p>&nbsp;<\/p>\n<p>\u2013\u00a0 world\u2019s best backgammon program<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Elevator Control<\/strong>: Crites &amp;Barto<\/p>\n<p>&nbsp;<\/p>\n<p>\u2013\u00a0 high performance down-peak elevator controller<\/p>\n<p>&nbsp;<\/p>\n<p><strong style=\"text-align: initial;font-size: 1em\">Dynamic Channel Assignment<\/strong><span style=\"text-align: initial;font-size: 1em\">: Singh &amp;Bertsekas, Nie&amp;Haykin<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>\u2013 high performance assignment of radio channels to mobile telephone calls<\/p>\n<p>&nbsp;<\/p>\n<p><strong>37.13 Robot in a Room Example<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">We take an example of robot in a room that has starting position as given in Figure 37.7. The actions that can be taken by the agent are UP, DOWN, LEFT, RIGHT. In this example we bring in the probability of each action. The agent moves UP 80% of time,moves LEFT 10% of time, moves RIGHT 10% of time. We are given the information that the reward is<strong>+1 at [4,3], -1 at [4,2].<\/strong>The reward for each step is &#8211; 0.04. We have to find the strategy to achieve the max reward.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-859\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-261.png\" alt=\"\" width=\"279\" height=\"201\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-261.png 279w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-261-65x47.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-261-225x162.png 225w\" sizes=\"auto, (max-width: 279px) 100vw, 279px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 37.7 Starting Board Position<\/strong><\/p>\n<p><strong>Optimal Policy Solution<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-860\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262.png\" alt=\"\" width=\"415\" height=\"224\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262.png 415w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262-300x162.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262-65x35.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262-225x121.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-262-350x189.png 350w\" sizes=\"auto, (max-width: 415px) 100vw, 415px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 37.8<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Optimal policy solution for the given robot example is shown in figure 37.8. Solution when the reward for each step is -2, -0.1 and -0.04 is given in Figure 37.9. The solutions when the reward for each step is -0.01 and +0.01 is given in Figure 37.10.<\/p>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-861\" src=\"http:\/\/csp15.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263.png\" alt=\"\" width=\"625\" height=\"398\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263.png 625w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263-300x191.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263-65x41.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263-225x143.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-content\/uploads\/sites\/65\/2019\/01\/2-263-350x223.png 350w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">As we can see from the example, when we change the policy in the environment, the optimal solution changes. It also effects the way the agent takes the action in each state.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<ul>\n<li>Outlined the key features of Reinforcement Learning<\/li>\n<li>Explained the elements &amp; models of Reinforcement Learning.<\/li>\n<li>Reviewed the MDP model<\/li>\n<li>Discussed some applications of RL<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<table>\n<tbody>\n<tr>\n<td><strong>you can view video on Basics of Reinforcement Learning-I<\/strong><\/td>\n<td><a href=\"https:\/\/youtu.be\/bjMmgVEuhxE\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-120\" src=\"http:\/\/epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/2018\/11\/download.png\" alt=\"\" width=\"36\" height=\"36\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Web Links<\/strong><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li>http:\/\/en.wikipedia.org\/wiki\/Reinforcement_learning<\/li>\n<li>http:\/\/www.cs.cmu.edu\/afs\/cs\/project\/theo-20\/www\/mlbook\/ch13.pdf<\/li>\n<li>http:\/\/neuro.bstu.by\/ai\/RL-3.pdf<\/li>\n<li>https:\/\/cs.uwaterloo.ca\/~ppoupart\/ICML-07-tutorial-slides\/icml07-brl-tutorial-part2-intro-ghavamzadeh.pdf<\/li>\n<li>ce.sharif.edu\/courses\/91-92\/1\/ce717-2\/resources\/root\/Lectures\/RL.pdf<\/li>\n<li>www.cogsys.wiai.uni-bamberg.de\/teaching\/ss05\/ml\/slides\/cogsysII-10.pdf<\/li>\n<li>https:\/\/www.cs.uic.edu\/~piotr\/cs594\/YijueRL.ppt<\/li>\n<li>www.cs.berkeley.edu\/~jordan\/MLShortCourse\/reinforcement-learning.ppt<\/li>\n<\/ul>\n<p><strong>Supporting &amp; Reference Materials<\/strong><\/p>\n<ul>\n<li>Richard S. Sutton and Andrew G. Barto, \u201cReinforcement Learning:An Introduction\u201d, 1998, MIT press<\/li>\n<li>Wiering, Marco, van Otterlo, Martijn (Eds.), \u201cReinforcement Learning\u201d, State-of-the-ArtSeries: Adaptation, Learning, and Optimization, Vol. 12 , 2012<\/li>\n<li>Stuart Russell and Peter Norvig \u201cArtificial Intelligence: A Modern Approach Prentice Hall Series in Artificial Intelligence), 2009<\/li>\n<li>Tom Mitchell, \u201cMachine Learning\u201d,McGraw-Hill Education, 1997<\/li>\n<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Alpaydin+Ethem&amp;search-alias=stripbooks\">AlpaydinEthem, <\/a>\u201cIntroduction to Machine Learning\u201d, The MIT Press; third edition, 2014<\/li>\n<li><a href=\"http:\/\/www.amazon.in\/s\/ref=dp_byline_sr_book_1?ie=UTF8&amp;field-author=Stephen+Marsland&amp;search-alias=stripbooks\">Stephen Marsland, <\/a>\u201cMachine Learning: An Algorithmic Perspective\u201d, Chapman and Hall\/CRC; 2 edition, 2014<\/li>\n<\/ul>\n","protected":false},"author":3,"menu_order":36,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-846","chapter","type-chapter","status-publish","hentry"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/846","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/users\/3"}],"version-history":[{"count":6,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/846\/revisions"}],"predecessor-version":[{"id":864,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/846\/revisions\/864"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapters\/846\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/media?parent=846"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/pressbooks\/v2\/chapter-type?post=846"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/contributor?post=846"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp15\/wp-json\/wp\/v2\/license?post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}