P3:Lecture 3 - Model-Free Policy Evaluation - 大佬的迷弟的粉丝 - BV1Cc411h7QQ
那么我们今天要做的,我们要开始讨论无模型政策评估,嗯,所以我们上次讨论的是,我们开始正式定义马尔可夫过程,马尔可夫奖励过程与马尔可夫决策过程,我们在研究这些不同形式的过程之间的关系。
这些都是我们在不确定性问题下建模顺序决策的方法,所以我们上周想的是,如果有人给我们一个世界是如何运作的模型,所以我们知道奖励模式是什么,我们知道动力学模型是什么,可能仍然很难弄清楚这样做是正确的。
我们如何采取行动,或者我们如何找到一个政策,可以最大化我们的预期,奖励折现金额,嗯,即使我们有一个模型,那么我们仍然需要做一些计算来尝试识别策略,所以我们很快就会得到的,我们如何做到这一切。
当我们没有事先得到世界的模型时,但让我们首先回顾一下政策评估的普遍问题,所以我们上次听到了一些关于政策评估的内容,当我们谈到策略评估是策略迭代中的一个步骤时,在政策评价和政策改进之间交替进行。
所以政策评估的想法是有人给你一个行动的方法,然后你想知道这个政策有多好,那么该特定保单的预期折扣奖励金额是多少,我们今天要讨论的是动态编程,蒙特卡洛,政策评估和TD学习,以及我们应该思考的一些方法。
试图比较这些算法,所以作为一个简短的回忆,记得上次我们定义了什么是马尔可夫回报过程,和马尔可夫奖励过程的回报,我们用g t定义的是,从那个特定的时间点T开始,我们获得的奖励的折扣总额。
所以我们会立即得到RT的奖励,然后我们要得到伽马,伽马是我们的折扣系数,记住,我们假设它在0到1之间,所以我们考虑的是未来的奖励,而不是眼前的奖励,状态值函数的定义是预期返回,一般来说。
预期的回报将不同于特定的回报,如果域是随机的,因为你今天开车去机场可能会得到的奖励,可能会不同于你得到的奖励,当你明天开车去机场的时候,因为交通会略有不同,它是随时间随机变化的。
所以你可以比较你是否知道在特定的一天,如果你花了两个小时到机场,而平均来说,你可能只需要一个小时,我们还定义了状态动作值函数,这是预期的奖励,嗯,如果我们遵循一个特定的策略,但我们首先采取行动。
所以我们是说如果你处于一种状态,s,你采取行动,从那时起,你遵循这个政策,别人给你的,预期的折扣奖励金额是多少,我们看到Q函数很有用,因为我们可以用它们来改善政策。
因为他们允许我们思考如果我们以后想遵循一项政策,但我们做一些稍微不同的事情开始,我们能看看这会如何帮助我们提高,就我们能获得的奖励而言,所以我们稍微讨论了一下,但作为回顾。
我们谈到了为政策评估做动态规划,所以当我们知道世界是如何运作的时候,动态编程是我们可以应用的东西,所以这是我们得到动力的时候,在本课程中,我将交替使用动态或过渡模型这个词。
所以如果你被赋予动态或过渡模型p和奖励模型,然后您可以进行动态编程来评估策略有多好,所以我们讨论的方法是,你初始化你的值函数,你可以把它看作是一个向量,现在我们在考虑有一组有限的状态和动作,因此。
您可以将此特定策略的值函数初始化为零,然后迭代直到收敛,我们说,一个国家的价值正好等于我们从,在那个州遵循那个政策,加上我们使用过渡模型获得的未来奖励的折扣总额,以及我们从以前的迭代中计算的值。
我们在这里讨论了定义收敛,收敛,一般来说,我们将使用某种规范,比较一次迭代中值函数之间的差异,接下来我们做这样的事情,v,pi,at,k-,k减去1时的v圆周率,等待这个比某个ε小,所以作为一个提醒。
我们正在计算的这个数量代表什么,嗯,我们可以想到我们正在计算的这个量,作为该政策下州S的K视界值的精确值,所以在任何特定的迭代中,就好像我们确切地知道我们会得到什么价值。
如果我们只能在有限的时间步内行动,就像K个时间步数,说,你知道如果,如果您在接下来的k个时间步骤中遵循此特定策略,相当于,你可以把它看作是价值的近似值,如果你永远演戏,所以如果k真的很大,k是200亿。
然后呢,这可能是一个很好的近似值,你会得到,如果你永远演戏,如果k是1,这可能是一个相当糟糕的估计,这会随着时间的推移而收敛,所以我认为用图形来思考这些事情也是有用的,所以让我们想想这个。
因为你处于一种状态,我用顶部的白色圆圈表示,然后你可以采取行动,那么动态编程是做什么的,它是在计算顶部的Vπ的估计值,通过说期望是什么,期望除以π的rt加γv k减1,那个期望超过了什么?
这将是s质数的概率给定sπ,那么我们如何从图形上很好地思考这个问题,我们从这个状态开始,我们采取行动,然后我们考虑下一个我们可以到达的州,我们再次假设我们处于一个随机过程中。
所以也许你知道有时红灯亮有时红灯关,所以根据这一点,我们将处于不同的下一个状态,我们正打算开车去机场,然后我们可以在达到那个状态后思考,然后我们可以采取一些其他的行动。
特别是在这种情况下我们可以采取一个行动,因为我们假设我们正在修改政策,然后从那些行动会把我们引向其他可能的状态,所以我们可以考虑画出我们可能到达的轨迹树,如果我们从一个州开始,开始遵循我们的政策。
在哪里,每当我们做出选择,我们只有一个行动,因为我们在做政策评估,每当有某种自然的选择,然后就像我们可能到达的下一个州的分布,你可以把这些看作是s素数和s双素数,像这样下去的时候,所以这有点。
你知道你的代理人可能出现的潜在未来,我认为用图形来思考这一点是有用的,因为这样我们就可以思考这些潜在的未来,我们如何利用这些来计算,价值是多少,这个政策的区别,嗯在什么动态程序中,我们在做什么。
和一般情况下,当我们试图计算保单的价值时,我们将对接下来的州进行预期,因此,价值是未来奖励的预期贴现总和,如果我们遵循这个政策,期望值正好在期货的分布上,所以每当我们看到一个动作。
然后我们考虑下一个可能到达的节点,我们想对这些特性进行期望,对我们能得到的所有回报的期望,这就是动态编程,或者这就是我们可以认为这个图表所做的,当我们思考动态编程所做的是,它估计了所有可能的未来。
通过引导并精确计算一个时间步长的期望,那么它是做什么的,它说s的vπ正好等于s的r,我的直接奖励,加伽马和除以s质数的概率给定s a v pi k减去1,最好的,所以它引导。
我们在那里使用bootstrap这个词,因为它实际上并没有总结所有这些更低的潜在回报,它在说我不需要那样做,之前我计算过它会是什么样子,如果我开始说在这种状态下,并继续为未来。
所以我现在已经知道那种状态的价值了,我要引导并用它作为替代品,实际上做了所有的展示,这里也是因为我知道预期的折扣,或者我知道什么嗯对不起,这个模型是,我也可以在s素数上取一个直接的期望。
所以我的问题是这里是否有一个隐含的假设,在给定的状态下的奖励,因此,被求值状态的值函数不会随着时间的推移而改变,因为您使用的是从先前的迭代中获得的,所以我想问题是说,这里是否有一个明确的假设。
即价值不随时间变化,是呀,这种情况下的想法是,我们计算的值是无限视界的情况,因此它是静止的,它不依赖于时间步长,我们今天不会太多谈论有限视界的情况,在那种情况下,在这种情况下就不一样了。
我们一直在说步骤,你总是有无限多的时间步要走,所以值函数本身是一个平稳的量,那么为什么这是一件可以做的事情,就像我们在自力更生,嗯,这是可以的原因是因为我们实际上有一个确切的表示,v,k,减一。
你不会得到任何近似误差把它,而不是明确地总结许多不同的历史,对不起,很多不同的未来奖励,所以当我们做动态编程时,这里要考虑的是,如果我们知道模型,然后知道动态模型和奖励模型。
我们可以准确地计算出即时奖励,我们可以精确地计算未来状态的期望和,然后我们代替而不是想我们,而不是想着把这个扩展出去,作为奖励的总和,我们可以启动并使用我们当前的估计v k-1,我强调这一点的原因是。
当我们开始研究这些其他方法时,比如蒙特卡洛方法和TD方法,他们不会再这么做了,他们会做其他形式的近似,试图计算这棵树,所以最终要计算策略的价值,我们本质上在做的是,我们在考虑所有可能的未来。
我们在每一个期货下得到的回报是什么,我们正试图使计算变得容易,尤其是当我们不知道世界是如何运作的时候,我们无法访问动态模型或奖励模型,好的,总结一下动态编程,你上次谈到了一点。
但我们没有真正谈论自助方面,动态规划说一个策略的值大约等于预期的下一个,对即时奖励的期望超过圆周率加上伽马倍,您计算的前一个值需要一个模型,它引导未来的回归,使用估计,用你的bk减一。
它需要马尔可夫假设,我这么说是什么意思,你没有去想过去的一切,你必须达到某种状态,你的意思是,不管我怎么到了以前的状态,我对那个状态的价值是相同的,嗯,我可以假设,我可以根据当前的观察单独计算。
所以我对此有什么问题吗,所以现在我们有点,主要是对上次的回顾,嗯,但稍微指出了一些我以前没有指出的事情,所以那些东西现在很有用,我们将在没有模型的情况下讨论政策评估。
所以我们现在要讨论的是蒙特卡洛政策评估,这是我们可以应用的东西,当我们不知道世界的模型是什么的时候,我们将讨论如何开始思考,比较这些不同形式的估计量,保单价值的估计量,所以在蒙特卡洛政策评估中,嗯。
我们可以再次考虑回归,所以退货又打折了,保单下的未来奖励总额,我们可以表示的策略的值,现在让我们想想我们能得到的所有可能的轨迹,嗯,根据我们的政策,什么是平均的,他们所有的回报。
所以我们可以再想想我们刚刚建造的那棵树,每一个不同种类的分支都会有一个特定的奖励,然后我们把它们都平均一下,所以这是一个很简单的想法,这个想法是,价值正好等于你的预期回报,如果你所有的轨迹都是有限的。
你可以拿一大堆这些,你平均,所以蒙特卡洛政策评估的好处是,它不要求你有一个特定的动力或奖励模型,它只要求你能够从环境中取样,所以我不需要知道一个特定的参数模型,比如交通是如何工作的。
我所要做的就是开车从这里到机场,你知道几百次,然后平均我花了多长时间,如果我总是用同样的政策开车,假设我总是走高速公路,嗯,那么如果我这样做,你知道一百次,那么我对我到达机场的预计时间有一个很好的估计。
如果我在高速公路上开车,这是我的政策,所以它不做自举,它不会试图在这个房间里维持,v k减去一,嗯,它简单地总结了你每一个轨迹的所有回报,然后是这些的平均值,它不假设状态是马尔可夫的,只是平均。
难道没有下一个状态的概念吗?这是否足以总结未来的回报,重要的是,它只能应用于所谓的插曲MDPS,如果你永远行动,如果没有概念,如果这有点像平均你的生活,这不起作用,因为你只有一个,所以你需要有一个过程。
你可以重复做很多次,这个过程每次都会结束,所以开车去机场可能会很长时间,但你最终会到达那里,然后你可以明天再试一次,所以这并不适用于所有的过程,就像你有一个永远在演戏的机器人,你不能做蒙特卡洛政策评估。
我们也经常以增量的方式这样做,这意味着在我们保持每集后的运行估计后,我们更新了目前对V PI的估计,我们希望随着我们获得越来越多的数据,这个估计会收敛到真实值,所以让我们来看看,嗯,这个的算法是什么。
所以一个算法,这被称为第一次访问蒙特卡洛政策评估算法当我们开始,我们假设我们没有,这里基本上是我们访问一个州的次数,所以我们开始,这是零,在任何状态下开始的返回或平均返回也为零,所以我们现在初始化说。
或者我们认为你知道我们没有得到任何州的奖励,我们没有去过任何一个州,然后我们要做的是循环每循环一次我们就取样一集,也就是我们在启动状态下开始,我们一直行动到我们的过程结束,我从我家出发,一直开车到机场。
然后我计算我的回报,所以我说,好的,嗯,也许我花了两个小时才到那里,所以现在我的G I是两个小时,嗯,但你只要计算你的回报,你计算每一步T在这一集里,所以这里的GI T是从那一集的T时间步定义的。
从那时开始你剩下的奖励是什么,我们将在火星探测器的例子中实例化这一点,然后你在那个特定的插曲中访问的每一个州,你第一次遇到一种状态,你看起来,你增加计数器,您更新您的总回报,你用,然后呢。
你只要取这些估计的平均值,计算当前对状态值的估计,为什么你可能在一集里不止一次处于相同的状态,好吧,假设我遇到红灯,假设我离散了我的时间步长,所以我每时每刻都在看我的状态,好吧,我遇到了红灯。
发生了一起交通事故,所以准时第一步我在红灯前,第二步,我在闯红灯,时间第三步,我在闯红灯,所以你可以在这一集的多个时间步中处于相同的状态,这意味着你只使用第一步,你看到那种状态了,然后你总结奖励。
直到那一集结束,我们看到了同样的状态,但我想在同一集的不同时间步骤,我们仍然会增加两倍,因为这不可能有差距,问题是发生了什么,如果我们在同一集里看到同样的状态,首次访问,您只使用第一个事件。
你把其他的都扔掉,所以当我第一次到红灯的时候,然后我会总结未来的奖励,直到这一集结束,如果我碰巧在同一集遇到同样的红灯,我忽略了那个数据,我们会看到一种不同的方法,一秒钟,好的,所以你知道。
我们如何估计这是否是一件好事,我们如何评估这个特定的,这是一个估计,有点不对,至少在我们没有太多数据的开始,那么我们如何理解这个估计是否好呢,我们如何比较,所有的估计量,我们今天要讨论的这些算法。
实际上只要举起你的手,因为我很好奇,嗯,他在这里正式地看到了偏见和方差在其他类别中的定义,好的,大多数人,但不是每个人,所以作为一个快速的回顾,让我们考虑一下有一个统计模型,它是由θ参数化的。
我们在一些观测数据上也有一些分布,x的p给定θ,所以我们想要一个统计θ帽,这是一个函数,所以θ帽是观测数据的函数,它提供了θ的估计,所以在我们的例子中,我们将有这个值,我们正在计算的价值的估计。
这是我们剧集的一个功能,它是对遵循这一政策的真实折扣预期回报的估计,因此,估计量偏差的定义是比较期望值是多少,我们的统计数据与真实值的对比,对于任何一组数据,所以这会说,如果我计算。
你知道我到机场的预计时间,基于三次试图开车去那里,我刚才给你们展示的算法平均来说是无偏的吗,这是我到达机场的真实预期时间,估计量方差的定义,比较我的统计数据和它的期望值,预期的平方。
我可以在true参数下得到的数据类型,均方误差结合了这两个均方误差通常是,我们关心的,正常情况下,我们最终关心的是,我们对我们关心的数量的估计与真实数量相去甚远,这是它的偏差和方差的总和。
通常不同的算法和不同的估计量会有不同的权衡,在偏差和方差之间,好的,所以如果我们回到我们第一次访问蒙特卡洛算法,我们使用的V pi估计器,对真实期望有一个无偏的估计器,我们政策奖励的折扣金额。
这只是一个简单的平均数,而且没有偏见,根据大数定律,随着你获得越来越多的数据,它收敛到真值,所以这也是所谓的一致,一致性意味着它收敛到真实值,当AS数据走向无穷大时,所以这是合理的,嗯。
但它可能不是很有效,就像我们刚才说的,你可能处于同样的状态,你可能在同一个红绿灯对许多人来说,许多时间步,嗯,你只会在一集里使用第一个状态来更新,所以每次去蒙特卡洛都很好,每次你在这一集里访问一个州。
看看你从那个州得到了多少奖励,直到最后,和所有这些的平均值,所以基本上每次你达到一个状态,你总是看折扣奖励的总和,从那里到这一集的结尾,你把所有这些都平均一下,这可能会更有效率,偏差定义,好的。
所以我有点困惑,我们会如何有偏见,鉴于我们实际上并不知道,我们如何通过它来竞争,是啊,是啊,鉴于我们没有,这是一个很好的问题,如何计算偏差,是呀,如果你,呃,如果你能计算偏差,准确地说,这通常意味着。
你知道θ是什么,在这种情况下,你为什么要做估计器,一般来说,我们不知道什么是偏见,嗯,我们可以经常把它捆起来,用浓度不等式之类的东西,我们就可以,嗯好吧,浓度质量更适合变体,经常,嗯。
我们不知道偏见到底是什么,除非你知道最基本的真相是什么,在实践中,我们有不同的方法来估计偏差,所以当你比较不同形式的参数模型时,嗯,有时你可以做结构性风险,呃,结构组合,最大化,诸如此类的事情。
试图得到你如何比较的数量,您的估计量和模型类,我不打算在这里多谈这个,但我很乐意用抵消来谈论它,所以每次去蒙特卡洛,我们每次都要更新它,这会给我们另一个估计器,注意,这将给我们更多的计数。
因为每次你看到一个状态,您可以更新计数,但这是有偏见的,所以你可以证明这是一个有偏的估计器,或者Vπ可能有直觉,为什么它可能是有偏见的,所以在第一个案例中,对于那些以前见过这个的人来说,嗯。
或者不一定是这个,尤其是,但看到这种分析,首次访问蒙特卡洛,嗯,你得到的是一个州的iID估计,一个国家的回归,对呀,因为你只拿那个,嗯,每集都是,嗯是我的,因为你开始了一个起始状态,你从那里估计,嗯。
您只使用第一次看到该状态时的返回,如果你在同一集多次看到一个状态,他们的回报是相关的还是不相关的,相关右,因此您的数据不再是IDID,这就是为什么,当你搬到每一个访问蒙特卡洛,你的估计量可能有偏差。
它是否出于明显的原因对检查员有偏见,悖论,像那样的过程,这是个好问题,我很高兴看到它并返回,然而,它的好处是它是一个一致的估计器,所以当你得到越来越多的数据,它会收敛到真实的估计,从经验上看。
它的方差通常要低得多,直觉上,它应该有捕鲸者的差异,我们平均了更多的数据点,现在通常是一样的,你知道的,如果你只访问一个,如果你不太可能重复访问同一个州,这两个估计量在一集里通常非常接近同一件事。
因为你不会多次访问同一个州,但在某些情况下,你会多次访问同一个州,你会得到更多的数据,如果您使用每次访问,这些估计器通常会更好,但这是有偏见的,所以有一个权衡,经验上,这往往要好得多,现在。
当然在实践中,经常而不是嗯,你经常,您可能希望逐步地这样做,你可能只是想跟踪跑步的意思,然后你跟踪你的跑步,意味着并逐步更新您的帐户,你也可以这样做,当你参观时,你不必等到最后,哦,那是不对的。
你一定要等到最后,因为你总是要等到得到完整的回报才能更新,是啊,是啊,在后面,所以这个问题,如果你喜欢,如果你的条件是你有相同数量的估计,大约在每个状态下,那么两者或多或少是相等的。
但另一个会不那么有偏见,比如说,如果你做了,我想这是不可能的,你本可以,比如说,或者看过的剧集,用第一次访问近似来每个州的人数相同,但如果你真的有,就会,你想象MSU会更低,在这种情况下,我会质疑嗯。
如果在两个算法中对一个状态的计数数相同,就剧集而言你不可能做到这一点,嗯,除非是这样,否则它们要么是相同的,如果你只访问一个州,嗯一集一次,然后它们就完全一样了,如果不是这样。
如果你在一集内多次访问一个州,然后当你得到同样的计数时,单次参观的会更好,因为它是公正的,它的方差基本相同,还有什么问题吗,所以增量蒙特卡罗在政策评估上基本上和以前一样。
除了你可以慢慢地移动你在每个州的跑步平均水平,重要的是,嗯,当你慢慢移动你的估计器,如果您将alpha设置为1以上,s,每次去蒙特卡洛都是一样的,本质上,你只是精确地计算平均值,嗯,但你不必这么做。
这样你就可以把它,这样你运行的平均值对最近的数据更有权重,你想这么做的原因是因为,如果你的实域是非平稳的,我们已经猜到了,其中域可能是非平稳的,这是一个高级话题,在这门课的大部分时间里。
我们不会真正讨论非平稳域,尽管在现实中它们非常重要,我不知道你们的机械零件是不是随着时间的推移坏了,喜欢的例子,如果你在一个制造过程中,你的零件在变化,随着时间的推移会崩溃。
所以你的动力学模型实际上是随着时间的推移而变化的,那么您就不想重用旧数据了,因为你实际上你的MDP随着时间的推移而改变,所以这是原因之一,通常在经验上像,当人们训练推荐系统之类的东西时,你知道新闻吗。
所有这些东西都不是静止的,所以人们经常重新训练他们来处理这个非平稳的过程,我在后面看到一个问题,是啊,是啊,所以从经验上来说,这通常对非平稳域很有帮助,但如果它不是静止的,所有的,有一堆不同的担忧。
所以我们现在基本上忽略这一点,好的,所以让我们来看看我们对蒙特卡洛的理解,关于政策评价的建议,让我们回到我们的火星探测器领域,嗯,所以在我们的火星探测器中,我们有这七个州,我们的火星车掉了下来。
它要探索一个奖励,处于一种状态,一个在州的七个,其他地方在零时都是正十,我们的政策将适用于所有州,嗯,现在想象一下,我们不知道动力学模型是什么,所以我们要观察轨迹,如果你到了第一州或第七州。
您采取的下一个行动将终止奖励,我不知道,可能是从悬崖上掉下来之类的,但每当你走到一步,It’7点还是1点,然后嗯,你采取的下一个行动,这样你就可以得到任何奖励,你要么得到一个,要么得到十个。
然后你的进程终止,所以让我们想象一下在这种政策下的轨迹,会是,你从三秒开始,你去行动,你采取行动一个,你得到的奖励是零,这是奖励,然后你过渡到状态二,你采取了一个行动,你得了零分,你保持在同样的状态。
所以你又呆在S 2,采取行动,你又得到了一个零的奖励,然后你到达状态1,采取行动,你得到一个,然后它就终止了,这是你的火星探测器生活中的一次经历,嗯,所以在这种情况下,嗯,我们花一两分钟。
可以自由地和邻居交谈并计算,第一次访问是什么,蒙特卡洛,每个状态的价值估计,每次访问是什么,蒙特卡洛州的估计,我把第一次访问和每次访问的算法都放在上面,就看这一集你是否只更新一次状态。
或者您是否可以多次更新它,你问这个问题,我也是,如果我们还没有看到,我们使用的值是多少,也可以说,对于所有s,初始化s的v p等于零,如果你还没看过的话,所有的权利,如果你想要多一点时间,请举手。
否则我们就继续,好的,所以有人想分享的,他们是什么,也许他们附近的人认为是第一次访问蒙特卡洛,每个状态的V估计,我认为第一个估计是每个州都有一个,除了最后一个,然后呃,我们只更新了哪些日期。
到目前为止有几个,你就会,呃,这就是为什么,别跟我来这套,嗯,让我们从这里开始,所以s one的v是什么,好吧,两个中的一个也是一个,和S 3中的V,也是4中的1和v也是1,你可能不同意,先生,好吧。
五个中的一个,芝诺和,是啊,是啊,所以我们只能在这一个中更新我们实际访问过的州,所以这里是1 1 0 0,零现在零,嗯,每次参观怎么样,蒙特卡洛估计只有两个,所以我只挑了两个。
因为那是我们唯一去过两次的州,什么事?它的估价是多少?它还会是,是的,是呀,它是,为什么,因为我们都是增量的,所以我们在它的末尾有一个是两个,但是GS也是2,所以我们完全实现了这两个,所以两次的回报。
当你在S 2开始的时候,加起来直到这一集结束两种情况都是一个,所以是两次,然后你平均超过这个,所以它还是一个,他们都是一体的原因是因为伽马是一体的,就像,在那个问题中不应该有伽马项吗?
是的这里我们假设伽马等于1,否则它们就会有一个伽马乘以这两个中的一些,是啊,是啊,没有好问题,我选了伽马等于1,只是为了让数学更容易一点,否则就会有伽马因子,我也是,好的很好,所以你知道。
第二个问题有点转移注意力,因为在这种情况下是完全一样的,但如果返回与S2不同,比如,假设处于一种状态会受到惩罚,那么他们可能会有不同的回报,然后我们会在那里得到不同的东西。
所以蒙特卡洛在这种情况下更新了,我们不得不等到这一集结束,但是当我们更新到这一集结束的时候,嗯,我们更新了s 3 s 2 s 1,那么蒙特卡洛在做什么,那么蒙特卡洛在做什么,嗯。
我把这种增量版本放在这里,你可以用在非静止的情况下,但你可以用另一种方式来思考,我也是,所以请记住如果你想让这与每次访问相等,你只需插入α的n次方s,这就是蒙特卡洛评估公司正在做的,只是平均这些回报。
所以我们要做的是,如果我们想想我们的树在做什么,在我们的例子中,我们的树将是有限的,我们将假设这些分支中的每一个最终都会终止,他们必须,因为我们只能评估回报,一旦我们到达它,所以在某个时候,比如这里。
当我们在火星上陈述一个或七个时,进程终止的示例,那么蒙特卡洛政策评估是做什么的,它近似地平均了所有可能的未来,通过总结穿过树的一个轨迹,所以它会一路向下采样直到到达最终状态,它把一路上所有的回报加起来。
就像奖励一样,奖赏,奖赏,嗯,我会比这里的奖赏更小心,每个州行动对都有奖励,所以你把这种情况下的所有奖励加起来,这就是它的样本,价值的um,所以请注意它没有做任何事情,嗯,呃,的。
它将如何进入对各州的期望,就是通过对轨迹的平均,它没有显式地查看给定的下一个状态的概率,S和A,这不是自举,只有当你一路出去看到完整的回报时,它才能更新,这就是它的样品,它不使用动力学模型的显式表示。
它不会引导,因为没有V的概念,k减去1,它只是总结了所有的退货问题,斯科特,政策评价,喜欢在罕见的情况下做得很差,嗯,很有趣,问题是,这么说公平吗,在非常罕见的情况下,这将做一个非常糟糕的工作。
很耐人寻味,它们是非常高的方差估计器,所以如果你是蒙特卡洛,你本质上就像推出未来一样,对,通常你需要很多可能的未来,直到你能得到一个好的期望,另一方面,对于像Alphago这样的东西。
这是用来解决棋盘游戏的算法之一,他们用蒙特卡洛,你知道的,我认为你做事要小心,这次推出的一些内容,当你开始控制,当你开始,因为这样你就可以选择动作,嗯,你经常想玩之间,但它并不可怕,即使有罕见的事件。
嗯,但如果你有其他信息,你可以用,它通常是好的,取决于你的其他选择,这是一个相当高的方差估计器,它可能需要大量的数据,它需要一个情节设置,因为你不能这么做,如果你永远在演戏,因为没有办法终止。
所以你必须能够有终止的进程,所以DP政策评估,我们有伽马因子,因为我们想处理各州介于两者之间的情况,大概等于1,但在这种情况下,我的意思是,如果我们有这样一个永远不会终止的案子,因为这一集永远不会结束。
所以从技术上来说,我们是否仍然需要一个伽马因子来评估策略迭代,对这个问题的政策评估是关于,在这种情况下,我们还需要伽马因子吗,那么在你的过程中,你可以有自我循环或小循环的情况呢,所以总的来说这个g。
你能知道,可以使用伽马因子,所以这可以包括伽马,当你计算这些时,你是对的,如果已知进程终止,你不必有小于1的伽马射线,因为你的回报不可能是无限的,因为您的进程将始终终止,嗯。
这不能处理你有可能终止的情况,所以如果在流程内部有一个自我循环或一个小循环,这样你就可以永远绕着它走,永远不会终止,你不能做蒙特卡洛,必须把这个拿出来对身体原因没有帮助,为什么你可能会有一个游戏。
不只是那样,这很像模拟燃料成本,或者我们行为的东西,那合理吗?嗯,伽马是否有物理原因,比如燃料成本,或者类似的东西,我的意思是我想通常我会把它放在奖励功能中,好的,所以如果你有像你这样的东西。
你可以吃那个,所以我想,考虑这样的情况,基本上你想尽快达到一个目标,你想做一个随机最短路径类型的问题,嗯,我想总的来说,我可能宁愿选择让它成为一个终端状态,然后有一个负的成本,如果你真的知道燃料成本。
嗯,但您也可以将其用作代理,试图鼓励朝着目标快速前进,挑战在于你如何设置它通常是相当微妙的,因为嗯,如果你把它定得太高,你会得到奇怪的行为,你的经纪人在哪里,有点害怕,什么都不敢做。
你只要呆在真正安全的区域,嗯,如果在某些情况下太高,如果有可能得到一些微不足道的奖励,你的经纪人可能会被误导,所以在现实世界中设置通常有点棘手,好的,因此,有高方差估计需要这些插曲设置和,没有自举。
一般情况下,它们在某些情况下收敛于真实值,呃,一般来说,温和假设,我们将在课程结束时讨论重要的抽样,如果我们有时间,否则我们可能会把它推到以后,那是我们怎么做的,如果您有非策略数据。
从另一个策略收集的数据,好的,现在,让我们来谈谈时差学习,所以如果你看看萨顿·巴托,如果你和里奇·萨顿谈谈,或者其他一些在这个领域非常有影响力的人,他们可能会争辩说这些中心。
对强化学习的贡献或对强化学习的贡献,使其不同,也许比其他一些关于自适应控制的思考方式更重要的是时间差异学习的概念,本质上,它将结合蒙特卡洛估计和动态规划方法,而且是免费的。
我们不会显式地计算动力学模型或奖励模型,或者从数据中估计它既引导又样本,所以记住动态动态编程,就像我们到目前为止定义的那样,它自举和我们到目前为止对它的思考方式。
你实际上可以接触到真正的动态模型和真正的奖励模型,但它通过使用V来引导,k减去1蒙特卡罗估计不引导,它们一直走到轨迹的尽头,还有一些奖励,但他们取样以接近预期,所以引导被用来近似未来,奖励折现金额。
抽样通常是为了接近你对状态的期望,时差学习的好处是,你可以在偶发过程或连续过程中做到这一点,它的另一个好的方面是,不用等到本集结束才更新,所以一旦你有了新的观察,在一种状态下开始,采取行动,去下一个州。
得到一些奖励,嗯,您可以立即更新您的值,这真的很有用,因为你可以立即开始使用这些知识,好的,那么我们在时差学习中要做什么呢,我们的目的是计算我们对V pi的估计,我们对回归的定义还是一样的,我们要看看。
提醒自己行李员接线员,所以如果我们知道我们的MDP模型,我们的贝尔莫尔接线员说我们会得到立即的奖励,加上我们未来奖励的折扣金额,在蒙特卡洛的每一次访问中,我们在做的是,我们在更新我们的估计。
使用返回的一个样本,所以这就是我们说我们的,我们对价值的新估计等于我们对价值的旧估计,加上阿尔法时间,返回,我们刚刚看到负V,但这是我们必须等到这一集结束时再做更新的地方,时间差异的内部,学习很好。
为什么我们不直接用我们的旧估计器v pi来表示那个状态呢,然后你就不用等到这一集结束了,所以在那里不用GI,你用奖励,你刚刚看到了加伽马倍,你下一个状态的值,所以你说,我不会等到这一集开始我的状态。
我得到了奖励,我去了另一个州,下一个状态的值是多少,我不知道,我去估价器里查一下,我把它插进去,我将把它看作是对回报的估计,所以最简单的TD学习算法就是,你只需要把你的即时奖励。
加上你的折现预期未来价值,我们把它插入你实际到达的状态,现在请注意,这是采样,没有,正常情况下,我们想要那笔好钱,行李员接线员,我们通常会有一个和s素数,给定s质数的s a的v pi的s质数的概率。
我们这里没有,我们只给你一个下一个州,我们把它作为我们的估计器,所以我们还是要取样,为了接近这个期望,但就像动态编程一样,我们要引导,因为我们要用我们以前对VPI的估计。
我们还写了一个子k和子k-1来显示,就像迭代一样,是啊,是啊,我现在可能有那个CLE了,我不知道,在这种情况下,你也可以写这个,建议是,如果我们想清楚迭代中发生了什么,你也可以把它看作是p的k加一。
这是V好的,比如说,你在随着时间的推移更新这个,问题是,你对每个州都这样做,与动态规划相比,你这样做的方式对所有州来说,所以你有一个一致的BK,然后你在这里更新,我们可以把它看作是一个值函数。
你只是在更新值函数的一个条目,取决于你刚刚到达的州,所以前面的值函数没有很好的概念,新值函数的,因为这个原因,我会把它放在那里,现在人们经常谈论TD错误,时差误差,那是什么,它在比较,你的估价是多少?
你的新预算,也就是你的即时奖励加上伽马倍,你实际达到的状态的价值减去你目前对你的价值的估计,现在请注意,这一个本质上应该是近似的,对s质数的期望,因为对于那个,你将平均,所以这看的是时间差异。
所以这是说你的直接奖励加上伽马倍有多大的不同,你下一个状态的值,相对于你对当前状态价值的当前估计,现在请注意,这不一定要归零,因为第一件事总是一个样本,这是一个未来,唯一一次它被定义为归零。
如果这是确定性的,所以下一个州只有一个,所以你知道如果我开车去机场的时候,我堵车了,有一半的时间我不知道,那么这是两种不同的下一个状态,对于当前的开始状态,我可以去,要么堵车,要么不堵车。
所以我要么会遇到交通堵塞,或者不撞车的V PI,所以这个TD错误不一定会归零,即使有无限的数据,因为一个是当前状态下的预期事物,另一个是你到达了下一个州,所以好的一点是,在您的状态操作之后。
您可以立即更新这个值估计值,奖赏,s素元组,你不需要插曲设置,是啊,是啊,收敛,如果你保持alpha常数,如果保持alpha不变,这会影响收敛吗,是呀,你通常必须对衰变有一些温和的假设。
像T除以1这样的事情通常足以确保这些估计收敛,是啊,是啊,问题,我们能说说系统的偏见吗,问题是这个问题是否是一个好问题,你能说说这个估计量的偏差吗,它可能会感觉到这是否会是一个偏差估计器,你以前呢?
或者我们有一种感觉,它是否会有偏见,回想一下动态编程是V,k减去一,无限视界的无偏估计器,如,假设k等于2,你想要无限的视界值,不管你怎么做这些更新,不会很酷的,一般当你引导,它将是一个偏差估计器。
因为您依赖于以前的估计器,这通常是错误的,所以这将使你在一个特定的方向上有偏见,所以这绝对是一个有偏见的估计器,嗯,它也可以有相当高的方差,所以它既可以是高方差的,也可以是有偏见的,但另一方面。
你可以非常非常快地更新它,嗯,你不必等到这一集结束,你可以使用很多信息,所以它通常比蒙特卡洛估计的高方差小得多,因为你在自拍,这有助于平均你的许多可变性,事实是。
我们基本上是在为序列号上的值函数初始化相同的值,哪个问题是它是否是初始化的函数,它不是它是一个,它是估计量不同性质的函数,你可以,以不同的方式初始化,嗯,自举是因为你使用的是通过自举。
并使用这个V PI作为你实际预期折扣回报的代理,嗯,除非这是真正的值,它只是会有偏见,你注意到这个,嗯,这不是你在动态编程中没有偏见吗,当你知道模特的时候,因为当你引导时,v pi实际上是v pi。
它实际上是真正的价值,所以问题是,这里是实际值的近似值,这就是为什么它对你有偏见,所以自举很好,如果你知道真正的动力学模型和真正的奖励函数,你计算的vπ是k减去1,但这里不好,因为我们引入了偏见。
那么电视零学习是如何工作的呢,嗯,我在这里做零,因为中间有一些有趣的嗯,在TD学习和蒙特卡洛学习之间,而不是立即奖励,加上未来奖励的折扣总额,而不是所有奖励的总和,你可以想象这两者之间的连续体。
你可能会总结前两个奖励,然后引导,所以有嗯,有一个连续的模型,基于一系列算法从直接获得奖励,然后自举与从不自举,但我们现在只想谈谈拿你的即时奖励,然后引导,所以TD学习的工作方式如下。
你必须选择一个特定的阿尔法嗯,可以是时间的函数,台阶嗯,初始化值函数,您对一个状态进行采样,在这种情况下,下一个状态是行动奖励,因为我们正在进行政策评估,我是说,这将等于pi s t,然后更新您的值。
好的,让我们再看看之前的例子,所以我们说第一次去蒙特卡洛,你会得到1-1-0-0-0,每次访问都是一次,在这一集结束时,所有州的TD估计是多少,所以请注意我们在这里做什么,我们循环。
我们对一个元组进行采样,我们更新状态的值,我们刚刚到达,我们得到另一个元组,我们取样,那么那会是什么样子,在这种情况下,我们将从,我们会有三个,我们会有三个一一个,如:’s two表示有…。
s two’s two,’s one’s one,加一个终止,所以让我花一分钟想想在TD下的价值是多少,学习,这可能会产生什么影响,我也是,好的,有人想说你得到的价值是什么吗,是啊,是啊,呃。
一个接着是所有的权利,好的,一个后跟所有的零,所以我们只更新了最终状态,在这种情况下,我也只是想,是啊,是啊,问题验证是否发生了这种情况,是啊,是啊,因为在这种情况下,我们所做的是我们得到一个数据点。
所以我们处于一种状态,我们采取行动,我们得到了奖励,我们得到下一个状态,我们只更新该状态的值,所以我们在这里做的是,我们有三个,我们更新了,我们做了一个动作,我们得到了一个零的二。
所以S3的新值也等于零,所以我们去了二号,1。我们采取了行动,我们得到了一个零,我们去了二号,我们得到了,所以我们更新了两个,也是零,我们又做了一次,当我们最终陈述一个,我们得到了一个,所以关于这一点。
可以是有益的,也可以是无益的,你以最幼稚的形式扔掉你的数据,你有一个s a r s素数元组,然后它又消失了,你不这样保存它,当你最终看到奖励,你不后退,你不能向后传播这些信息。
所以蒙特卡洛所做的就是一直等到他到达那里,然后它计算沿插曲的每个状态的返回,这意味着这就是为什么我们得到了一个,一个一个,但在这里,当你到达,嗯,It’只有一个。
你已经抛弃了你曾经在三年级或二年级的事实,那你,你不更新这些状态,时间直到奖励与样本数成正比,你需要对值函数有一个很好的估计,再说一遍,我假设,你得到奖励的时间就越长,你需要喜欢的样品就越多,估计数。
我不完全确定的问题是,你知道,你要花多长时间才能得到奖励,你需要多少个样本才能得到值函数的估计值,嗯,你是说所有的州,有点细致入微,嗯,这也取决于过渡动力学,嗯,你不能为某一个特定的,就像。
一个特定的州需要多少样本,对它的回报有一个很好的估计,假设你的奖励是随机的,但就传播这些信息所需的时间而言,这取决于动态,所以在这种情况下你知道,如果你有完全相同的轨迹,你再做一次。
然后你最终会更新这是两个,那么如果你再次得到同样的轨迹,然后再将信息传播回s 2,然后再一次,然后你把它调回S三,实际上是第三个,这是第三个,所以你可以慢慢地把这个信息传播回来,嗯。
但你不会马上喜欢什么,蒙特卡洛会做问题,我在想,如果你能强调一下这和我们讨论过的Q学习之间的区别,上次,因为它们看起来有点相似的想法,这很好,所以完全正确,事实上,TD学习和Q学习非常相似,Q学习是。
嗯,当你要做控制,所以我们要看动作,TD学习基本上是Q学习,你在策略中固定的地方,刚才的问题,所以如果你真的想实现这个,所以你会继续循环并更新,或者你只是跑过去一次,这取决于,所以我,这取决于你问谁。
所以如果你真的真的比较关心记忆,嗯,你只是删除数据,所以你想让我们在很多现有的深度学习方法中,你保持了一个情节重播缓冲区,然后你会重新取样,然后你会对那里的样本进行更新,所以你可以重温过去的东西。
用它来更新你的价值函数,嗯,你也可以它可以,你这样做的顺序可能很重要,所以在这种情况下,你可以通过你的数据,然后再做一次,或者从最后倒退,你再过一次,你最终会把一些alpha传播回S2右边,是啊,是啊。
所以你就像收敛一样,或者我们很快就会讨论这个,是呀,有一个很好的问题,所以你这样做是为了收敛,我们一会儿再谈这个,是啊,是啊,所以一定要让我明白,所以当我们谈论元组采样时,到底发生了什么。
在这里通过一个轨迹,你在迭代theta,非典,轨道上的两个螺栓,对呀,但我们认为这真的是演戏,呃,所以嗯,重复这个问题,问题是我们正在经历这个轨迹,我们按元组更新,是呀,但我们真的在考虑这个。
就像你的经纪人处于某种状态,采取行动,使你的措辞进入下一个状态,所以不存在完整的轨迹,就像我在开车,在接下来的两分钟里我会发生什么,所以我没有完整的轨迹,我正在迭代它,每次都是这样,进入那个轨迹。
我更新,所以我不必等到,我有完整的轨迹,我想这两个人被选中的顺序,i,我猜,这对你在估计中得到的元音很重要,是呀,所以问题就像,您知道接收元组的顺序,这绝对会影响你的价值,嗯,所以在,呃。
如果你是根据你在这个世界上的经历来理解这一点的,这只是命令,你在世界上经历过这些,所以这个s t加t,加一个质数在下一个时间步中成为你的ST,所以这些不是从弹道中取样的,就像你现在在哪里。
如果您可以访问批处理数据,然后你可以选择哪些,它绝对会影响你的收敛,问题是你通常不知道该提前挑选哪些,我想说的另一件事,所以有点微妙,嗯,如果你把alpha设置为like,你知道一个比T。
或者类似的东西,你可以保证这些东西会聚,呃,有时如果阿尔法真的很小,嗯,这些将被保证在较小的条件下收敛,但是如果你说α等于1,它肯定会振荡,α等于1,意思是你基本上忽略了你以前的估计。
所以如果你把alpha设为1,那么你只是在利用你的TD目标,好的,那么什么是时间政策差异政策评估,如果我们用这个图表来思考,把我们看作是对未来的期望,所以它是,嗯,这是它在上面的方程,它所做的是。
它通过使用st加1的样本来更新其价值估计,近似预期的下一个状态分布或下一个未来分布,然后它引导,因为它插入了你之前对正1的v pi估计,所以这就是为什么它是动态编程的混合体,因为它引导蒙特卡洛。
因为它没有对接下来的所有状态做明确的期望,只取样一个,好的,所以现在,我们为什么不想想这些事情,允许我们比较这些不同的算法及其优缺点,这有时取决于应用程序,如果要我选哪个最受欢迎。
可能是TD学习最受欢迎的,但这取决于域,这取决于,嗯,你是否受到数据的限制,或者嗯,你知道,计算或内存,等等,所有的权利,所以我们为什么不花几分钟简单地讨论这个问题呢,所以说。
花一分钟思考这些属性中的哪一个,从你到目前为止记得的,适用于这三种算法,那么当您没有当前域的模型时,它们是否可用,它们是否处理持续的非插曲域,他们可以处理非马尔可夫域,它们收敛到极限中的真值。
我们假设现在一切都在表格中,我们不在函数近似地,嗯,你是否认为他们给了你一个公正的价值估计,所以如果在任何时间点,如果你把你的估计量,如果它是公正的,所以我们为什么要花一分钟看看你能不能填满这张桌子。
随时和你旁边的人说话,然后我们会跨过它,所有的权利,当您没有当前域的模型时,其中哪些是可用的,动态编程是否需要当前域的模型,蒙特卡洛可用吗,那t怎么样,这两种TD都不被称为什么,作为一个无模型的算法。
不需要一个明确的概念,它依赖于从现实世界中对下一个状态的采样,其中哪一个可以用于连续的非插曲域,所以你的进程可能不会终止,好的,那么TD学习可以用来,是呀,是呀,蒙特卡洛可以用,不能使用DP。
这些中哪一个需要马尔可夫,蒙特卡洛需要马尔科夫,TD需要Markobian吗,所以嗯,时差与动态规划,依靠事实,当前状态的值不依赖于历史记录,所以不管你到了现在的状态,它忽略了,嗯,然后它利用这个。
当它也启动时,它假设没有,所以蒙特卡洛只是把你现在的回报加起来,直到这一集结束并注意到这取决于你什么时候达到那个特定的状态,你的回报可能不同,这可能取决于历史,所以蒙特卡洛不依赖世界是马尔科夫。
您可以在部分可观察的环境中使用它,td假设世界是马尔可夫的,按照我们目前的定义,动态编程也是如此,所以你引导,你说,对于当前状态,我对未来价值的预测只取决于当前的状态,所以我可以说我得到了立即的奖励。
加上我过渡到的任何状态,这是对历史的充分统计,我可以插入我的引导估计器,所以它依赖于马尔可夫本质非马尔可夫域,然后把它涂在上面,嗯是的,所以问题很好,你说的不处理是什么意思?就像这些是算法,你可以。
你可以把它们,嗯,所以耶,你可以将这些算法应用于任何事情,问题是,它们是否保证会聚,在正确价值的极限中,他们不是,如果世界不是马尔科夫式的,他们不喜欢,以及我们在早期智能辅导系统的一些工作中看到的。
我们用了一个分数导师的数据,我们正在应用马尔科夫技术,它们不会聚,我是说,他们会聚到完全错误的地方,不管你有多少数据,因为您使用的方法依赖于一个不正确的假设,所以你需要能够评估马尔可夫。
或者试图约束偏见,或者做点什么,嗯,否则,你对保单价值的估计可能是错误的,即使在无限数据的极限下,嗯,收敛到极限中的真值怎么样,让我们假设我们又在马可夫的案子里,所以对于马尔可夫和域DP。
收敛于关于蒙特卡洛极限中的真值,是呀,TD怎么样,他们所有人都做这个世界真的是马尔科夫式的,所有东西都是渐近收敛的,在较小的假设下没有,所有这些都需要次要的假设,在次要假设下,它就会收敛到极限的真值。
取决于喜欢的alpha值,嗯,对价值的无偏见估计是蒙特卡洛,无偏估计量,是呀,好的,TD不是DP有点奇怪,这不是一个很公平的问题,dp总是给出该策略的确切bk减去一个值,所以这是完美的,那就是。
准确的值,如果你有k或者1 k再减去一次,行动步骤,这与无限视界值函数是不一样的,最后两行不一样,好像我不明白,无偏估计量之间的差值,我们只是一个真正的价值,问题很大。
所以问题是某件事没有偏见和始终如一有什么区别,嗯,所以当我们说收敛到真值时,分钟,也称为形式上的一致估计器,所以对值的无偏估计意味着如果你有有限数量的数据,你计算你的统计数据,在本例中,值。
并将其与真实值进行比较,那么平均来说,这个差异将为零,对于像TD这样的事情来说,这不是真的,但是嗯,这可能是对有限数量数据的评估,如果你有无限多的数据,一致性会说什么,当你得到真正的值。
所以这意味着对TD的说法,渐近地,偏差必须为零,如果你有无限多的数据,最终它的偏差为零,但对于少量,你知道对于有限数量的数据,你真的知道你不知道N是什么,嗯,它可以是一个偏差估计器。
但是你拥有的数据量是无穷大的吗,那么它必须收敛到真正的值,所以你可以有偏见的东西,一致的估计量,是啊,是啊,为了蒙特卡洛,我想我们说过实施会影响到,它是有偏见的,因为我以为我们说过,如果是每次访问。
好问题,是呀,所以我质疑是好的,所以这是,嗯,这是对,嗯,第一次访问,每一次访问,大问题,所以这可能是一个多余的或愚蠢的问题,但是有没有,你知道的,模型自由政策评估模型实际上不是收敛的,是呀。
问题是有没有没有模型的政策评估方法不收敛,是呀,当我们开始工作时,我们会经常看到它们,近似值,当你开始的时候,所以现在我们在表格中,这意味着我们可以用表格或向量来写,当我们移动到无限状态空间时。
我们的值是什么,嗯,很多方法甚至不能保证收敛到任何东西,我们甚至没有讨论它们是否收敛到正确的值,它们甚至不能保证停止振荡,他们可以不停地变化,好的,是啊,是啊,问题那么为什么有任何二七解释。
为什么TD不是无偏见的,就是为什么TD不是UNBI,为什么,呃,是啊,是啊,大问题,所以问题是说,你知道的,为什么TD有偏见,TD是有偏见的,因为你插入了下一个状态值的估计值,那是不对的。
这通常会导致一些偏见,您插入的估计量不是真V,π代表s质数,只是为了一点建议,所以这真的是自助的部分,这就是问题所在,蒙特卡洛也在取样,而且没有偏见,至少在首次探访个案中,这里的问题是。
你插入了一个预期的折扣奖励金额,那是不对的,所以这只是总结了那里的,我认为有一些重要的属性需要考虑来比较它们,嗯,你如何在这些算法中做出选择,所以我认为考虑偏差和方差特征很重要。
数据效率和计算效率也很重要,在这些之间会有权衡,嗯,所以如果我们想想一般的偏见,这些不同形式算法的方差,蒙特卡洛是公正的,一般高方差,嗯,这是一致的TD有一些偏见,远低于蒙特卡洛TD的方差。
零用表格表示收敛到真值,正如我所说的,一旦我们进入函数逼近,它并不总是收敛的,我们很快就会看到更多关于这一点的信息,我想在最后几分钟,我们就有机会通过一点点,关于这些方法是如何相互关联的。
当我们开始考虑批量设置时,就像我们在火星探测器的这个特殊例子中看到的那样,再来一次,对比一下,嗯,蒙特卡洛估计数,等到这一集结束,然后更新了那一集访问过的每个州,td只使用每个数据点一次。
所以它最终只会改变最终状态的值,在这种情况下,如果发生了什么如果我们想不止一次地检查我们的数据,所以假设我们愿意花更多的计算,所以我们实际上可以得到更好的估计,更有效地采样。
这意味着我们希望更有效地使用我们的数据,这样我们就可以得到更好的估计,所以我们经常称之为批量或离线,嗯,我们有一些数据的政策评估,我们愿意尽可能多地经历它,为了得到对保单的估计,用来收集数据的。
所以让我们想象一下我们有一组K集,我们可以反复采样一集,嗯,然后我们要么把蒙特卡洛或TD应用到整集,在这种情况下会发生什么,嗯,所以有一个很好的例子,从set到,假设只有两个州。
所以状态a、b和gamma等于1,你有八集的经验,你要么,第一集你看到一个零B零,所以这是B中的奖励,你在《对不起》中看到的,然后是另一组你刚开始在B中的剧集,你得到了一个,你观察六次。
然后在第八集你从B开始你得了零分,所以首先,我们能计算出在这种情况下b的v是多少吗,所以世界的模型是这样的,b和b有时变成1,B有时归零,然后我们总是终止,所以在所有八集里,我们在其中六集里看到了B。
我们得到了一个,在其中两个,我们得到了一个零,如果我们在做蒙特卡洛,我们对b的b值的估计是多少,所以我们做了一个蒙特卡洛估计,用这八集,我们可以想看多少遍就看多少遍,我们不只是要经历每一集。
一旦这是批处理数据集,有人已经为我们收集了这个,可以对这个数据集进行蒙特卡洛更新,你想吃多少就吃多少,B的V的估计是多少,三分,在蒙特卡洛估计中等于6除以8,B的TD估计是多少。
记住TD做的是他们得到这个S A R S素数,你引导,你做α乘以r加上γv,你做一个减去你以前估计的阿尔法,什么是,这里,在这种情况下,你可以把alpha变成任何小的东西,你要做无限次。
所以这是批处理数据设置,所以对于TD,你只会在你的数据上运行数百万次,直到收敛,基本上,有人能猜到b的v代表td吗,也是四分之三,好的,对于TD也是如此,这是一样的,因为无论何时你在B中,你总是终止。
所以这真的就像是B的一步问题,所以对于TD,也会说b的v等于6除以8到3/4,因此,这两种方法在批处理设置中一致,如果你能在无限长的时间内检查你的数据,嗯,b的v等于三六八,也是如此,嗯,呃呃。
在两种方法下,有人知道在蒙特卡洛的领导下,是啊,是啊,蒙特卡洛下的A将为零,为什么,是啊,是啊,好,呃,因为唯一的轨迹,你有一个持久的结束,只有一个轨迹,我们有一个A,它得到了零奖励。
你认为TD会发生什么,只是,会是零还是非零另一个什么,因为您可以从信息中绑定值,因为你可以报废,如此如此是的,只有当你在一个,你碰巧在那个轨迹上得到零,但这是在TD,你会说,嗯,你得到了一个即时的零。
零加伽马乘以b的v和b的v是四分之三,所以这里,伽马等于1,所以你估计在TD下这将是四分之三,这样它们就不会收敛到同一件事,那么这为什么,嗯,呃,这就是我们刚刚经历的,我们可以用这些概率来思考。
那么这里发生了什么,批处理设置中的Monte Carlo转换为最小均方误差估计,因此,它最大限度地减少了相对于观察者返回的损失,嗯,在这个例子中,a的v等于零,TD,零收敛到动态规划策略。
动态和奖励模型的最大似然估计,所以它相当于如果你本质上只是通过计数,你估计了s质数的p帽子给定s a,所以对于这一点,可以说给a的去b的概率等于1,因为你唯一一次,你去了B,然后B的奖励等于四分之三。
而A的奖励等于零,然后你会用它做动态编程,你会从,取出值,所以TD收敛到这种最大可能性,mdp值估计,蒙特卡洛只是收敛到均方误差,它忽视得很好,它不假设马可维乌斯,所以它没有用它们,这个马尔可夫结构。
为了确认上一张幻灯片,你说的是多次检查数据,因为对于第一次迭代的TD学习,a的v等于零,是的,因为B说过,他假设过了一段时间,BB已收敛到四分之三,是完全正确的,所以在联机设置中,嗯,如果你只看到一次。
呃,那么对于特定的更新,a的v将为零,只是如果你做了很多很多,很多次,然后它会收敛到另一个东西,所以你很清楚哪个更好,如果你的世界不是马尔科夫式的,你不想收敛到某件事,好像是马尔科夫式的。
所以蒙特卡洛更好,但如果你的世界真的是马尔科夫,嗯,那么你从TD那里得到了很大的好处,因为它可以利用马尔可夫结构,所以即使你从来没有得到过一个,你可以利用你有很多关于B的数据的事实。
并用它来获得更好的估计,我鼓励你们思考如何计算这些模型,就像它被称为确定性等价物,你能做的就是把你的数据,计算你的估计动态和奖励模型,然后用它做动态编程,这通常比这些其他方法更有效地收集数据,嗯。
P4:Lecture 4 - Model Free Control - 大佬的迷弟的粉丝 - BV1Cc411h7QQ
所有的权利,在我进入技术阶段之前,我们要开始了,我们会做一点后勤工作,嗯,所以我们开始了这些叫做会议的事情,我们在广场上宣布了他们,如果你没有,如果你没有得到我们的广场的东西,一定要报名参加广场。
或者给我们发条,嗯,会议旨在进入材料,再深一点,也来讨论一下家庭作业的问题,嗯,有结构化的会话,与办公时间相反,在那里你可以一对一地问关于家庭作业的问题,那个啊,这些课程旨在更深入地研究材料。
他们都是基于我的一些同事,学生在其他班级有多喜欢他们的反馈,以及去年的一些要求,希望有机会更深入地研究材料,所以我们在广场上宣布了这些,这个想法是你将注册一个会议,它们是可选的,你不必做这些。
我们将给参加他们的额外百分之一的学分,如果你参加足够多的,细节也已经公布了,我认为这是真的,如果我没记错的话,发邮件给我,我想已经宣布了,也在广场上,所以如果你去广场,有许多不同的会议。
你可以报名参加他们的报名点,确保我们有足够的空间,但我很肯定我们几乎能容纳任何会议,你想去的,最后一次会议将通过缩放完成,并特别针对SCPD学生,但欢迎任何人做这件事,嗯,我们将跟踪的方式。
不管人们是否去参加会议,我们将有一个代码,在,所以你只需要写上代码来表明你的出席情况,我们将记录最后一次会议,所以如果出于某种原因,你的日程安排如此,你不能参加这些,但你想参加会议。
你可以稍后浏览这些材料,然后使用该代码记录你参加了它,我们将依靠斯坦福荣誉守则,只有这样做的人才会上传代码,然后我们有任何关于会议的问题,什么会,那些又涉及到什么,它们是可选的,他们要更深入地研究材料。
嗯,有些人真的很喜欢这种东西,能看到你的想法,这是一个实验,所有的权利,还有什么问题吗?会议以外,所以作业被释放了,本周办公时间照常,嗯嗯,如有任何问题,请随时与我们交谈或使用Piazza。
我们现在就开始吧,那么嗯,像往常一样,我真的很感激,如果你用你的名字,每当你问问题或发表评论时,所以今天我们终于要开始做决定了,在那里我们没有世界的模型,特别是我们将关注模型自由控制。
所以我们今天要讨论的是,一个代理人如何开始做出好的决定,当它不知道世界是如何运作的时候,它不会显式地构造一个模型,嗯,记住,在这种情况下,一个模型将是一种奖励,或者环境的动力学模型,所以今天我们要看。
不涉及构造,动态或奖励模型,只是直接从经验中学习,我们上次主要讨论的是,也许我们不知道世界是如何运作的,我们没有这些明确的动态和奖励模型,但是,我们将试图评估提供给我们的一项政策,而现在。
我们将考虑真正的问题,在强化学习中经常出现的,这就是当一个代理人不知道世界是如何运作的时候,他们应该如何做出决定,他们仍然想最大化他们预期的折扣奖励,当我们想到一项政策有多好。
一旦我们有了关于一项政策有多好的信息,然后我们可以开始思考如何学习一个好的政策,事实上,当我们刚开始上课的时候,我们讨论了如何学会做出好的决定,或者如果给你一个世界的模型,你会如何计算好的决定。
所以这就是我们现在要回到的,所以特别是,现在我们可以考虑开始解决这个优化和探索的问题,我们仍然不打算进行概括,但这很快就会发生,嗯,我们已经看到了一点,这甚至想出了计划,但现在我们将开始思考如何探索。
我们如何进行优化,所以当我们想到好的时候,我想我只是要经历更多的这些,当我们开始进入这个区域时,所以我们又要考虑,我们如何识别一个有很高期望灰尘的政策,计算的奖励总额,会有延迟的后果。
这意味着我们的代理人采取了可能看不到的行动,这些行为在一段时间内是好是坏的结果,我们将开始考虑探索方面,好的,所以让我们从,嗯,你知道,这些类型的问题出现的地方,人们在那里建模。
当我们考虑马尔可夫决策过程时,也许不是建立一个模型,所以我想这可能是强化学习成功的第一个例子,在这种模式下做,免费的方式是双陆棋,大约是1994年,他们训练一个特工玩双陆棋,棋盘游戏,嗯嗯。
实际上使用神经网络,神经网络在大约10-15年的时间里已经过时了,然后又回来了,但在90年代初,人们使用神经网络,杰里·塔萨罗用它来玩双陆棋得到了一些非常好的结果,这是强化学习的第一个演示之一。
一个更大的设置,你可以解决这些复杂的游戏,嗯,许多其他问题也可以建模为MDP,无论是游戏、机器人、客户广告选择还是入侵物种管理,在许多这样的情况下,我们事先不知道模型,所以我们今天要考虑的是特定的情况。
主要是在这里,我们认为模型是未知的,但如果我们能取样,但偶尔也会有这样的情况,我也是,你知道模型的地方,但它真的真的很贵,所以对于计算可持续性或气候建模,你也许可以写下一个很好的世界模型。
但运行起来真的真的很贵,因为实际上模拟气候真的真的真的真的很难,即使那样,你的模型也可能令人印象深刻,但我只是我提出第二点,从某种意义上说,当我们主要考虑向世界学习的时候。
我们认为一个机器人就像在世界上跑来跑去,这是一件昂贵的事情,因为机器人需要实时来做这件事,但你也可以想想那些正在学习,与模拟器交互,那也很贵,所以我们今天要想的主要是,就是所谓的政策学习。
在那里我们获得了关于世界的直接经验,然后我们试图用它来估计和评估一个政策从经验,但我们也要储存,开始更多地谈论非策略学习,在那里我们获得关于世界的数据,我们用它来估计做事的替代方式。
所以我们可以结合尝试不同事物的经验,试图了解一些我们自己没有做的事情,然后嗯,第三件事真的很重要,所以第二件事真的很重要,所以我只想在这里简单地谈谈,所以假设你有一个案例,说现在只有一个州。
但就像你有一个状态,It’只有一个,你做一个,你呆在一号,然后你做一个1,或者你是一个,你做一个二,呆在一号里,然后你做一个二,所以你希望能够把这些经历结合起来,所以你可以学习这样做。
即使你从来没有这样做过,你从来没有经历过那种完整的轨迹,但你希望能够推断,从以前的经历中,所以这种政策将是一种非政策学习,因为它与我们以前尝试过的政策不同,当我们考虑Q学习时,我们会更多地讨论这个问题。
所以让我们从广义策略迭代开始,好的,所以如果我们回到策略迭代,我们在几节课前的策略迭代中讨论过这个问题,当我们知道世界的模型时,我们最初看到了它,所以这是我们计算什么是正确的事情的一种方式。
给了正确的东西,意味着最大化我们预期折扣奖励金额的政策,那么当我们知道世界是如何运作的时候,我们该如何做到这一点,我们得到了我们的动态和奖励模型,那样的话,我们可能随机初始化一些策略,所以说。
再次初始化意味着我们将s的pi设置为,A适用于所有人,这通常可能是随机选择的,嗯,然后我们做了这个政策评估程序,其中我们首先计算了策略的当前值,然后我们更新了政策,我们拿走了我们所拥有的一切。
然后我们又做了一件事,你可以把它想象成再做一个行李员备份,我们说过,好的,我们把那个V,我们把它插到这里,我们利用了我们知道动力学模型的事实,我们知道奖励模式,我们正在计算这一步,更新的PI素数。
我们谈到了这样一个事实,当我们这样做的时候,我们实际上得到了单调的政策改进,这有时被称为政策改进定理,所以当我们用某种,在这个例子中,在这个例子中,我们知道动力学模型,我们知道奖励模式,嗯。
保证总是给我们一份保单,这至少和以前的政策一样好,或者更好,最终它被保证会聚,至少在我们有有限状态和作用的情况下,因为只有有限数量的策略,所以在这种情况下,只有一个可能的政策。
所以我们最多只能做一个到S次的整个过程,因为每次我们要么选择更好的政策,或者我们保持不变,一旦你找到同样的政策,你是,你做完了,所以现在我们想做这一切,但我们无法获得动态或奖励模型。
那么有人知道我们如何才能做同样的事情吗,现在我们不知道动力或奖励,您可以维护一个计算的转移概率矩阵,当你体验到是的时候,1。这个建议很好,如果我们试着,呃,如果我解释正确,什么。
如果我们试图从世界上估计一个动态模型和一个奖励模型,然后我们可以用这个,你仍然可以计算你的值函数,也许用我们上次看到的一些方法,然后你可以做这个更新这个策略改进,使用你估计的世界动态和奖励模型。
那是完全合理的做法,嗯,我可能有任何其他的想法,我们可以做什么,是的,名字和实际上,我想总的来说,有一个计算机模型,我们能不能去掉模型,直接尝试估计一个特定状态的价值,或者也是零动作状态动作测试。
所以只是呃,不做所有的模型,我们只是呃,呃,估计屋顶,你在行动中得到了什么,是的,实际上你知道,是啊,是啊,所以实际上所说的正是我们今天要看的路径,我们将重点讨论模型自由控制。
所以我们今天不打算直接估计一个模型,其实我个人非常偏爱模特,它们可以非常有效地取样,但今天我们不打算看那个,我们将完全按照刚才的提议去做,我们要计算一个铜,如果我们计算一个Q函数。
记住Q总是状态和作用的函数,我们将直接估计Q函数,然后我们就可以直接使用Q函数来进行政策改进,那么我们该怎么做呢,这是蒙特卡洛的政策Q评估,它看起来很像蒙特卡洛的政策价值评估,但我们得做几个修改。
所以在,如果我们这样做是为了V,我只是要把它写出来形成一种对比,所以对于v,我们只计算了状态的数量,现在我们有了状态动作对的数量,在我们记录G之前,这可能是我们在所有剧集中看到的之前奖励的总和。
对于s的g,现在我们要为s逗号做这个,然后现在我们要代替价值函数,我们会有一个Q PI,所以基本上几乎所有我们以前有的地方,现在我们有s逗号a,然后它看起来会很相似,所以我们将假设我们仍然得到一份保单。
我们可以取样一集,然后我们计算每一个时间步长的GI T,现在记住会,我是说那是以前的事了,但我们要考虑一下,它还与该时间步长的特定状态和特定动作相关联,然后对于每个状态动作对。
要么是我们第一次看到状态动作对,或者每次我们看到状态动作对,我们总是可以像以前一样,我们可以有第一次访问或每次访问,我们只是要更新我们的计数,更新我们的总奖励金额,然后估计我们的Q函数。
基本上和以前一模一样,除了现在我们做的一切都超过了状态动作对,一旦我们有了,现在政策改进比以前更简单了,嗯,所以我们给出了q函数的估计值,现在我们可以直接在上面取一个arg max,因此。
我们将新策略定义为前一个策略的arg max,到目前为止有人觉得这样做有什么问题吗,对于我们在这节课中一直在思考的政策类型,到目前为止,我们考虑的政策大多是确定性的,这意味着从状态到动作有映射。
我们一直在考虑这是一个,嗯,确定性映射,所以我们总是为特定的状态选择特定的动作,是啊,是啊,在后面和名字,首先,哦,是和,我们实际上在探索任何东西,是呀,但是我们从来没有探索过的问题是什么。
哪个是正确的,但是不去探索有什么问题呢,我们只一遍又一遍地采样一条路径,我们从来没有真正了解过,关于我们看不到的世界其他地方,所以我们不知道它是否质量更好,到目前为止,其他地方是在说。
也许我们只对一条路径进行采样,我想他更重要的是,所以你仍然可以对不同的路径进行采样,因为您的状态空间可以是,但你只能尝试一个州的一个动作,所以你永远不会知道那会是什么样子。
如果你在那种状态下拿了一个2而不是一个1,这意味着当你为任何特定的州这样做时,你只会看到一个相应的动作,所以每当你看到状态的时候,你唯一会看到的动作是一个,或者你的政策规定在那里做什么。
这意味着你不会有任何关于在那里做任何其他事情的信息,这意味着你的政策改进会很无聊,因为你不会得到任何关于你应该做的事情的其他信息,所以我们必须进行某种形式的探索,基本上,现在,我们必须开始有某种随机性。
在我们的政策中,或者它需要随着时间的推移而改变,这样我们就可以尝试不同的事情,即使是在同一个州,学习该做什么,是呀,我们事先知道整个行动空间吗,大问题,第一个问题是我们是否事先知道整个动作空间,是啊。
是啊,我们将假设我们至少做了所有的讲座,和一般情况下,是啊,是啊,所以你就不能,动作最初有很高的价值,所以在计算之后,当它可能计算出一些低的东西时,所以下次你看到它的时候,你会尝试另一个动作。
刚刚提出了一个很好的建议,这与我们如何初始化线索有关,所以你可以做的一件事,这就是克里斯托弗刚才建议的,你可以把你的Q函数初始化得很高,到处都是,您基本上可以做所谓的乐观初始化,嗯。
这实际上是一个非常有用的探索策略,如果你以一种特定的方式初始化它,然后呢,你可以有一个可证明的保证,你需要多少数据,为了收敛到最优策略,所以乐观的初始化通常是一件非常好的事情。
对初始化事情的方式要小心一点,比如这些值应该是什么,但总的来说,从经验上来说,它真的很好,从形式上来说,它可以非常好,我也是,嗯,我们今天不讨论乐观初始化,但我们稍后会在课堂上讨论优化。
所以这种方法不依赖于马尔可夫假设,能够估计,Q右,是呀,但我的问题是,每当我们定义策略时,我们只根据状态来定义它,如果你从国家获得的奖励取决于你的历史,那么这就打破了马尔可夫假设,甚至对不起。
即使奖励没有标记出来,那么你的政策是我们在定义政策,是啊,是啊,所以现在问的是一个重要的问题,所以你的现实世界可能是也可能不是马尔科夫,我们现在谈论的所有政策,假设世界是马尔科夫。
策略只是从当前状态到操作的映射,它们不是历史的函数,所以这些可能会很好,也可能不会很好,因为你的现实世界可能是也可能不是MDP,如果不是,那么您考虑的是本质上受限的策略类,只考虑从即时状态到动作的映射。
如果你,你应该做什么真的取决于整个历史,那么你可能不会做出好的决定,好的,这就是你扩展蒙特卡洛的基本方法,能够开始估计线索,一旦你有了它们,你可以做政策改进,但现在,很明显,我们需要在如何。
我们应该积累经验。所以当我们试图改进政策时,我们实际上可以改进,嗯,因为在我们的现在,我们不知道世界的真正动态是如何运作的,所以我们需要做一些政策评估和改进的交织,我们还需要考虑如何进行探索,一般来说。
这可能看起来有点微妙,所以我们已经听到了一个很好的建议,也许你可以乐观地初始化一切,也许这会帮助你探索它,一般来说,可能看起来有点难,我们怎样才能得到这个好的Q PI估计,因为Q PI的作用是。
上面写着,嗯,如果你想对Q PI有一个很好的估计,所有的S A和所有的A,它会说你需要去每个不同的州,采取一切可能的行动,然后从那时开始跟着圆周率,那么我如何确保我参观了所有这些东西,嗯。
我们今天要讲的是一个非常简单的策略,以确保您访问的东西通常在一些关于潜在过程的温和条件下工作,所以真正简单的想法是通过偶尔的随机来平衡探索和开发,所以让我们想象有有限数量的动作,我们称之为基数。
这里有一个嗯,那么关于状态操作值的e贪婪策略如下所示,有概率,一减ε,你将根据你当前的状态动作值函数采取最好的动作,否则你就会采取行动,所以概率为1减去ε,你根据你对Q函数的估计,取你目前认为最好的。
用概率epsilon,你选择其他动作中的一个,所以这是一个非常简单的策略,好的是它仍然足够,但在我们这样做之前,我们为什么不举一个简单的例子,以确保我们意见一致。
所以让我们想想我们如何在政策上做蒙特卡洛,对我们的小火星探测器的Q评估,嗯,所以现在我们的火星探测器将有两件事可以做而不是,嗯,我们将对此进行更多的推理,所以我在这里写下了奖励函数,如果你采取行动。
你得到同样的奖励,我们以前一直在谈论,也就是1 0 0 0 0 0加10,现在我正在改变它,我是说你的行为,你的奖励取决于你的状态吗,以及你所采取的行动,所以2的动作现在将是,你到处都是零。
最后你得到一个加5,伽马是其中之一,让我们假设我们目前贪婪的政策是,1。你在哪儿都能找到行动,我们用的是五点的ε,我们从贪婪的政策中提取一个轨迹,贪婪的政策意味着什么,我把epsilon设为第五点。
这意味着一半的时间我们将采取我们的电流,贪婪的行动政策,一个1,另一半时间,我们要么拿一个,要么拿两个,所以作为一个例子,这将产生一个轨迹,比如状态三,动作1 0状态2,现在这是一个我们随机抽样的案例。
所以我们抛硬币,我们说过,哦,这次我要随机,那我又得抛硬币了,看看我是在采取行动还是在采取行动,我拿了一个二,在那里我得到了零的奖励,然后剩下的轨迹如下,我想问你的问题是,人们和邻居交谈。
当然是现在所有州的Q估计,对于这个轨迹末端的动作1和动作2,使用蒙特卡洛估计,所以我们是第一次来,在这种情况下,关于我们在Epsilon空间中选择的动作的问题,当我们触及探索的表面时。
包括政策上的行动很重要吗,或者我们应该从我们的行动中排除那个行动,我们可能会增加探索的机会,也不那么便宜,政策问题是,当你现在击中一个时,是否会随机做一些事情,你是否应该排除你通常会采取的行动。
如果你很贪婪,嗯,你可以,在某些方面,这就像选择了一个不同的epsilon,我听到的谈话比平时少,有人对此有什么澄清问题吗,或其他问题,科迪哈哈哈有个主意,但是,好的,是啊,是啊,所以嗯。
如果每个人都准备好回答,所以说,你们觉得怎么样,所以在这种情况下你会有三个,你初始化的一切都是零开始对吧,所以你所做的一切,不是你所没有看到的每一个状态动作对,都将保持为零,是啊,是啊,特别是s3的q。
a,one将为零,因为你见过一次,当你看到它的时候,它是0,q,s,two,eight,two也将是0,s 3的q a 1等于0,唯一不为零的是s的q,在这种情况下,这将是一个,因为你见过一次。
当你看到时,你得到的奖励是一个,这是一个答案是,我们有不同的答案,所以我们看到的所有状态动作对都是一个,所有其他状态动作对将为零作为另一个答案,所以我有第三个答案,所以你说的对TD的案子是正确的。
你所说的对上周或昨天来说都是正确的,或者星期一,我想它可能有第三个答案,你能重复一下,第二个选择是,所以第一个选择是我们只更新一个一个,第二个选择是我们所看到的一切现在都将是一个,也许我误解了它是什么。
所以我们将有两个不同的,我们现在有两个向量,所以我们有1的q和2的q,他们看起来不会一模一样,所以有时我们采取行动,有时我们采取行动,我们只能更新我们看到的,我们所采取行动的回报。
那么我们采取了什么行动呢?只看到一个,对呀,所以这意味着对于那些人来说是三个,这将是一个低于Q的三一个一,所以我会把所有的零一二三四都填上,我们拿过2和3吗,否,所以也必须为零。
因为我们从来没有从那里开始,采取行动得到回报,我们采取什么行动呢?对呀,所以对于那个我们得到一个1,所以我们基本上只是分发你的经验,所以现在如果你要最大限度地超过这些。
你就会得到和我们上次在蒙特卡洛看到的一样的东西,也就是1 1 0 0 0 0 0到最后,嗯,但在这里,我们正在细分我们的样本,所以你只能体验到你在这个州实际采取的行动,因为我们在蒙特卡洛的案子里。
我们会看到电视机箱或Q学习,我们稍后会叫它,然后我们可以把所有的奖励加起来到这一集的结尾,所以g是所有步骤的和,我没有强调,哦,我做得很好,我们在这里保持伽马等于1,只是为了让所有的数学,只是添加。
是啊,是啊,只要Q的一半,对于一个QS,这是唯一的区别吗,你能在这两个州都访问两次吗?问题是是否,如果我们每次都去,如果这里有什么变化,抱歉,打扰一下,在这种情况下不会改变,因为他三次访问。
到这一集结束的奖励总数是一个,所以你会有两个一数,然后你除以二,它确实,它实际上可以是不同的,但基本上是不同的,如果你得到了不同的奖励从那时到这一集结束,也许我误解了,所以我觉得你说一切都很特别。
我错过了,你是说这两个动作不一样吗,所以最少一个,我们在轨迹中看到的动作垫和零到,但是是的,很抱歉,好的,所以现在我们要正式地证明这是正确的,所以嗯,我们要证明这一点,就像我们以前做的那样。
当我们在做政策改进的时候,我们展示了如果你选择了一个政策,嗯,嗨,我,这是由贪婪产生的关于你的Q函数,然后保证产生单调的改进,同样的事情在这里也是如此,我也是,当你贪婪的时候,所以如果你用贪婪的策略。
然后您可以收集数据,以便,新政策,你得到的新值,如果你对此持乐观态度,或者对不起,如果你对此很贪婪,然后你会得到一个新的更好的政策,好的,所以让我们说嗯,我们有一个贪婪的政策。
然后我们将调用一个关于Q PI的epolicy,就是圆周率加1,所以我们有一个贪婪的政策,在过去进行了一些探索和贪婪,我们用它来收集数据,然后我们评估了该策略,我们得到了这个Qπi。
现在我们要提取一个新的政策,我们要做政策改进,我们将证明这是一个单调的改进,有人对我们所展示的有什么问题吗,好的,那么这意味着什么呢,所以现在我们要展示的是,就是这个q函数,所以它会比我们以前的值好。
至少和我们以前的旧保单价值一样好或更好,所以我们现在定义它的方式是,这里的q函数是,我们的政策是随机的,所以是圆周率,加上我们在特定状态下采取行动的概率之一,S a的q pi i。
然后我们要把它扩展开来,我们将重新定义它,贪婪的政策意味着什么,所以记住在贪婪的政策中,我们要么随机拿一些东西,那可能是Epsilon,我们把我们的概率质量分成所有的动作,这就是我们如何得到这个方程。
所以这上面写着这是,这是随机的部分,所以有概率有概率Epsilon,我们采取一个行动,其中一个动作,然后我们会从那时起跟随它,所以这只是s a的q pi i,然后概率为1减去Epsilon,我们很贪婪。
我们根据当前的Q PI I遵循最佳动作,所以现在我们要做的是,我们要重写第一学期不会改变,我要扩展第二个,我在这里什么也没做,我刚把最后一项乘以1,但我把它表达为Epsilon上的一个,除以1除以ε。
现在我要把那部分表达出来,所以我不打算重写第一个学期,加一减去ε,最大值超过a,我要把它重写为,它将利用这一事实,每当我们定义我们的E贪婪政策时,如果你把某一状态下的所有动作相加。
这些都是我们在那种状态下采取这些行动的可能性,所以它必须和为一,所以我先除法,我只是在一个特定的地方乘以一,表示为1减去ε,除以1减去ε,那么我就表达了,因为这必须等于1。
因为我们必须在特定的状态下采取一些行动,我们的政策总是要考虑在一个州采取任何行动的可能性,必须等于1,然后我会做那个表情,因为这里是我们采取最好行动的地方,所以根据定义,最好的行动必须是。
至少和采取任何其他行动一样好,所以我们要做下面的事情,我们要把Q往里面推,所以它必须比我们之前看到的要小,因为基本上我们只是把Q往里面推,我们不再取q值的ma,所有的Q值充其量必须等于最大值。
在其他情况下,他们通常会更糟,好的,但一旦我们有了,我们可以在Epsilon上取消那个,减去1除以ε,我们有什么,我们这里有两个不同的术语,看起来非常相似,我们有,我做了一个,让我们看看。
在那部分我犯了一个错误,看看这个,啊,是啊,是啊,在一个,所以现在我要把它拔出来,所以我把这些条款分开了,第一项和第三项相同,减一加一,当然清楚了,所以这最终成为中期,这只是以前的值,是呀,行。
我们把它改成了,而不是给定s的πa的所有a的和,在基数a上减去epsilon到减去epsilon,在这种情况下,是呀,嗯,是不是那个看起来还是那个,哦,是呀。
所以我们从一个减去Epsilon到下一行所做的,所以我们有一个1减去Epsilon,除以1,我把它表示为给定的圆周率上的和,s减去ε,除以a,然后如果你和一个,那是第二个学期,就像Epsilon一样。
第一项是一项,3。你能给我写上你的名字吗,对不起,按i打开而不是按,对不起,我还是不明白你的问题,所以你在第二行是对的还是,在第一句中,在第一句中,好的,π加一对不起,问题是什么,在这一边。
你有i加一和by,任何类型的是,是啊,是啊,谢谢谢谢你抓住它,你能解释一下你是如何工作的吗,是啊,是啊,这么好的问题,大线等于发生,因为我们推了Q PI,我们有一个最大值超过Q PI。
我们把它推到和里面,所以这个和现在不再包括最大值,所以现在最大值总是大于或等于任何其他元素,所以这就是你得到大于或等于,是啊,是啊,金鸡不知道你能不能直观地解释一下,为什么我想我明白问题是。
但我不想明白你为什么要做一些随机的次优动作,然后你最终得到更多的原子,是啊,是啊,所以我们能给出一些直觉吗,这是代数推导,我认为直觉上这个想法是通过做一些贪婪的探索,你会得到其他州行动对的证据。
然后你可以用这些来估计你的Q函数,当你这么做的时候,那么这也会给你一个,那么你就可以改善你的政策,因为这样你就有证据表明你可以做得更好,然后现在这个,你现在正在做的事情,如果你不做任何探索。
你的Q函数和以前没有变化,但现在因为你在做探索,然后你可以学习其他的东西,然后如果更好,你会在你的Q函数中看到,如果它没有改善,所以当你做Q值函数的时候,就是你的探索没有那么好,然后你就把所有值的旧的。
所以这就是现在,嗯,这是说你会得到这种单调的改善,如果你精确地计算这个,所以这是一个重要的部分,所以这个节目,所以这里显示的是,如果你得到一个Q函数,和,看起来从你没有采取的其他行动中得到了一些改善。
现在,你会把你的政策转向专注于这些行动,这是假设现在,根据Q PI被精确计算的单调改进,这就是我们在做计划时看到的,我们知道奖励模型中的动力学模型是什么,我们用它来计算一个值函数,如果我们在这种情况下。
我们有保证的单调改进,因为我们有圆周率的确切值,这里也一样,如果我们有q pi的确切值,然后当你做这个改进的时候,那么你保证会单调地提高,如果你不喜欢,如果你有一个q pi的近似值,它可能不会像。
假设你在那种状态下尝试了另一个动作,从那时起,你可能对事情有多好有一个错误的估计,所以这是一个重要的方面,当我们开始考虑函数逼近时,这将是非常重要的,因为我们几乎永远不会精确地计算q pi i。
但如果你真的喜欢,假设您可以遍历这个,无数次,就像你在学习一样,那仍然是一个表格环境,你们聚集在一起,你知道你的Qπi是完美的,然后当你做政策改进的时候,嗯,你可以得到一个福利,你可以你可以改进它。
所以会有一个有趣的问题,你多久改进一次你的政策,与您花多少时间评估当前的策略相比,是啊,是啊,哦是的,是啊,是啊,所以这是否意味着这肯定会收敛到,就像一个最佳立方体,喜欢提示功能,就总体方案而言,是啊。
是啊,我们会讨论这个问题很好,所以这只是说一步单调的改进,在总收敛方面会发生什么,我们一会儿再谈这个,是呀,提醒我的名字,拜托了,这可能是一个很容易回答的问题,我现在记得,但是嗯,当我想到。
我认为这是一个状态的函数,在这里读作为一个动作的函数,给定一个状态,第一个问题只是想让我们重新振作起来,什么是圆周率,以及我们如何定义函数,现在我们把它看作是从状态到行动的映射,但它可以是一个随机函数。
所以它可以是动作的概率分布,所以我可以用50%的概率选择一个动作,或者以50%的概率行动一个二,比如说,从相同的状态,我是说这取决于你想如何实现它,就像那样可以开始在,但本质上我认为你处于一种状态。
然后你有一些关于动作的概率分布,你必须从中取样来决定你采取什么行动,所以这里我们输入一个状态,政策,所以我们在这里做什么,当我们扩展的时候,这是,我们说过,给定一个州的行动的政策是什么,我们说过。
在一个负ε的概率下,我们将采取这个最大的行动,所以一个有epsilon概率的,我们将采取其中一个动作,然后我们总结了我们可以采取的每一个行动,所以我们在那里做的是,我们把这个总和分成采取一个行动的概率。
这个动作的Q函数是什么,以及采取其他每一个行动的概率,这些东西的价值是什么,所以这就像我们的期望值,是啊,是啊,在后面,就像我们谈到行李员接线员的时候,我们说过,如果你得到相同的值,但你知道。
在你知道之前,你就像你可以停止在这里迭代,你必须尝试每一个动作吗,知道你完蛋了,问了这个伟大的问题,这是以前在政策改进方面,如果你有同样的政策,你知道你完蛋了,你不必再做任何改进了。
问题是在这种情况下是真的吗,或者还有其他一些附加条件,这也与问题密切相关,所以我们为什么不进入下一部分说,你知道吗,在什么条件下,这些会收敛并收敛到最优,你以前有问题吗,是啊,是啊,就快点。
这是否也说明了我们唯一严格的时候,等式是当Epsilon为1时,所以我们只是纯粹随机的行为,问题是是否,有嗯,所以说,如果策略是随机的,你们这里的质量会更严格吗?嗯是的,你应该得到。
我是说你可以得到更严格的质量,当你聚集在一起喜欢的时候,如果你的Q函数是收敛的,你的政策是最优的,那你就限制了质量,我想当你只是不,我不这么认为,因为如果你的行为完全是随机的,事实上。
这通常是你开始的方式,然后你想从那里提高,你面试过吗,我是说,如果你是,如果你的奖励不是统一的,有些东西会比其他的看起来更好,所以即使你的行为是随机的,有些动作会比其他动作有更高的回报。
这将反映在你手中的Q函数中,在我们开始后面的收敛之前,只是一个请求,第二个和更多的,你只有一个,哦对不起,这应该,嗯,你在探索时排除艺术最大值吗,我们要不要排除艺术最大的行动,你有像探索。
贪婪的部分和一台机器,嗯我不,你不不排除,您不排除Argmax操作,当你探索的时候,你把它们都挑出来,嗯,如果你愿意,这相当于定义了你,你可以这么做,但在最简单的版本中,包括在这里的证明中。
我们假设当你随机行动时,你只需从任何一个州取样,从实现到,好的,伟大的问题,让我们,嗯,我也写在这里了,我没事,所以这里的几个人提出了另一个很好的问题,嗯我没事,嗯,随着时间的推移,这意味着什么。
嗯好吧,我们有这种单调的改进,我们有什么保证,所以我们的保证是,如果对所有状态操作对进行采样,无限次,你的行为策略收敛到贪婪策略,我这么说是什么意思,嗯,所以这里的行为策略是你使用的策略。
相对于你当前的Q来说,什么策略是贪婪的,好的,所以如果你有这种情况,这是极限,当我到圆周率的无穷大时,给定的s转到arg,max,皮肤和概率1,这意味着在极限中,你收敛到总是对你的Q函数采取贪婪的行动。
那你就贪婪于无限探索的极限,那叫欢乐合唱团,所以这意味着你访问所有的状态操作对无限次,但你也在汇聚,请原谅我对你的Q函数贪得无厌,嗯,有不同的方法来做到这一点,一个简单的方法是腐烂你的,随着时间的推移。
你的Epsilon或你或你贪婪的政策,嗯,所以你可以以超过1的速度将你的epsilon降低到零,比如说,那就足够了,不一定,这与你想做的经验是分开的,这只是为了在这种情况下展示,那么嗯。
那么我们通常可以证明,我们将收敛到蒙特的最优策略和最优值,卡洛和电视方法,所以一般认为什么时候会再谈这个,当我们谈论其他一些算法时,通常当你高兴的时候,你有一些条件来学习Q函数,那么您将保证收敛策略。
这是唯一能保证,就像通过减少Epsilon,和,哦,是啊,是啊,这是我的荣幸,是啊,是啊,所以问题是这是保证它的唯一方法吗,嗯,这里发生了一些有趣的不同的事情,呃,你可以保证你收敛到最优的Q函数。
不收敛到最优策略,所以你可以让Epsilon保持很高,嗯,你可以得到很多信息,或者你会学习最优Q函数是什么,但您可能没有遵循该策略,我们一会儿会更多地讨论这个问题,所有的权利。
所以让我们更多地谈谈蒙特卡洛控制,在这种给定的前兆中,所以如果我们想做蒙特卡洛在线控制,而不仅仅是我们之前说过的这个评估,我们可以把学习Q函数的这些想法结合起来,在做这个改进的同时。
所以我们可以初始化我们的Q函数和计数,就像我们之前说的那样,嗯,然后我们可以做的是我们可以构建一个贪婪的政策,所以在这种情况下,贪婪的政策总是,概率为1减去ε,我们选择相对于Q的arg max。
用概率epsilon我们选择一个动作,这样重写,a上的概率ε,我们选择动作A,所以我们总是把这个随机的,嗯,或者贪婪,是啊,是啊,有点在上面,所以实际上喜欢最佳动作,在这种情况下,你选择的概率是1。
在Carality日减去Epsilon加Epsilon,对呀,是啊,是啊,好的,是啊,是啊,伙计们,这是,呃,有几个人问过这件事,所以本质上,你太贪心了,概率为1减去ε加上ε除以a。
剩下的概率是随机探索,因为当你随意的时候,您还可以选择当前最好的操作,所以嗯,这看起来和我们之前看到的很相似,我们将在完成这一集后试播一集,那么在这种情况下,我定义为第一次访问不,你可以每次来都这样。
福利和限制在这里适用于我们以前所拥有的,从某种意义上说,你可以给出一个稍微有偏见的估计器,如果你每次都去,但一般来说,您将能够使用更多的数据,它会变得不那么吵,所以在这种情况下,我们所做的是。
我们只是保持状态动作对的计数,我们正在更新我们的Q函数,然后在我们完成那一集之后,然后我们可以更新我们的K和我们的epsilon,在这种情况下,我们只是用epsilon等于1/k。
然后我们重新定义我们关于Q的新的E贪婪政策,然后我们得到另一集,所以这只是一种蒙特卡洛在线控制,那么我们为什么不回到火星探测器的例子呢,所以在火星探测器的例子中,我们得到的是我们的两个q函数。
所以在这一点上,让我们花点时间讨论一下我们的新政策是什么,嗯,如果我们在这一集的结尾,只要写下领带就可以了,如果有两个q函数具有完全相同的值,对于同一状态,对于两个不同的动作,只有一条领带。
你可以选择如何打破领带,嗯,然后也写下新的E贪婪政策是什么,只要花一分钟做那件事,哈哈哈好吧,我们贪婪的政策是什么,我们贪婪的政策是什么,一个1,我们贪婪的政策是什么,那么我们贪婪的政策是什么呢?
然后它对其他一切都是什么,领带,并取决于您的实现,你要么永远是,你可以定义你的贪婪政策,或者你只是想随机断绝关系并跟踪它,你可能会不断地随机断绝关系,从经验上来说,这可能会更好。
而不是预先定义一个贪婪的政策,你可能总是很可爱地询问Q的Argmax是什么,如果你有领带,只需随机打破它们,以获得更多的探索,嗯,所以如果我们定义一个E贪婪策略,其中k是3,我们的ε是k的1。
我们遵循随机的概率是多少,所以k是三,ε等于1/3,所以这意味着我们有三分之一的概率选择随机的东西,我们有三分之二的概率选择圆周率贪婪策略,这就是那一集的更新,所以如果你这样做,如果你这么做了。
如果你在无限探索的极限中有贪婪的蒙特卡洛,然后你将收敛到最佳状态动作值,所以现在我们要开始谈论电视方法,和我们看到的相似,呃为了呃,蒙特卡洛,会有一个简单的类比,这让我们转向TD,所以记住TD。
我们之前得到的是,它等于我们以前的s的v pi,加1减去α次,哎呀,也许我们读到,α乘以r加γvπ,减去Vπs,这是我们取样的地方,期望,因为我们只得到一个S素数的样本,我们正在自举。
因为我们用的是我们以前对v pi的估计,所以这有点,TD学习的两个关键方面,我们都在蒙特卡洛自拍和取样,我们在取样,但不是自举,嗯,TD学习的一个好处是,我们可以在每一个元组之后更新它。
而不是等到这一集结束,就像我们对蒙特卡洛做的那样,我们在比赛所有的VS都有线索,我们要在这里做完全一样的事情,所以现在,我们将考虑这种通常被称为时间差异的东西,控制方法,我们现在要做的是。
我们可以用时差估计q pi函数,用贪婪的策略更新,然后我们可以通过将PI设置为E来进行蒙特卡罗改进,贪婪版Q PI,所以这将是我们能做的一件事,有一种算法叫做sarsa,它代表国家行动奖励,下一个状态。
下一个动作,所以莎莎,如何开始工作,所以我们所做的是随机初始化我们的E贪婪策略,比如说,嗯,我们采取行动,我们观察一个奖励和下一个状态,然后我们采取另一个行动,我们观察到另一个奖励和下一个状态。
然后我们更新我们的Q如下,我们说我们以前的值,我们对ST A T的Q值,会是什么,我们之前的值其实是,我会小心的,我们不会再用圆周率来索引它们了,因为我们有一个连续的估计,我们的政策也会改变。
所以我们得到的Q函数,现在不仅仅是为了一项政策,随着时间的推移,我们可以改变我们的行为方式,所以这是一个T,它将等于s,t,a,t的q,s t的q加上a t加上1减去s t a t。
这个方程的重要之处在于,我正在插入实际的动作,接下来拍的,所以你看到你处于一种状态,你做一个动作,你得到奖励,你去了下一个州,然后你做另一个动作,所以一旦你知道你所做的下一个动作是什么。
那么您可以在sarsa中进行此更新,因为你实际上是在插入所采取的行动,一旦你有了,你可以用正常的方式做政策改进,所以你可以有ST等于,所以就像现在的EG包装纸一样,所以这和蒙特卡洛有点不同有两个原因。
嗯,这是一种,呃,我们正在做这些元组更新,我们看到国家行动,奖励,下一个状态下一个动作元组,一旦我们做了这些,我们可以更新我们的Q函数,嗯,但我们可以一路上做这些,我们不必等到这一集结束,同样。
我们也不必等到这一集结束,改变我们在世界上的行为方式,就像我们之前看到的轨迹一样,我们多次看到一些状态,在这种情况下,我们实际上可能会改变我们的政策,因为我们在同一集里在这些州的行为。
所以如果你的剧集真的很长,这真的很有帮助,一般来说,嗯,我认为经常更新政策是非常有帮助的,是啊,是啊,谢谢。有什么原因,这里就像一个阿尔法,一个自己,哦对不起,在上面,是阿尔法,我们的孩子。
因为它们是标准的,哦耶,所以他们都是一样的,只是要么,你可以写在你把V放在下一部分的地方,也可以不写在下一部分的地方,所以你可以把它写成1-alpha倍,你的旧价值加上奖励加上你下一件事的伽马。
或者你可以把它写成v加alpha乘以,或者这应该仍然是这里的输出,加奖励加减v,所以要么是我自己,他们是一样的,如果你知道我打错了字,只要让我知道,是啊,是啊,你有什么理由可以用。
就像你选择的下一个状态动作对加一而不是最大值,关于的国家行动问题,为什么我们使用您选择的下一个状态操作对而不是最大值,Q学习将是最大的,我们将在大约一张幻灯片中看到这一点,萨拉基本上在更新政策,嗯。
一般可以有,你想做Q学习,这将是最大的,有时也有一些好处,尤其是在,你可能会有很多负面的结果,做麦克斯的乐观最终会,导致你的经纪人在早期做出了很多错误的决定,因为它真的很乐观。
它能做什么而不是它实际上在做什么,嗯,在萨顿和巴托里面有一个很好的悬崖散步例子,他们表明萨尔萨实际上在早期阶段做得更好,早期样本与Q学习的比较,因为Sara很现实,如果你接下来采取某些行动会发生什么。
而不是乐观,如果你做了很多随机性,这意味着斯塔克在早期阶段可以更现实,但从经验上来说,通常你想做关键学习,两者都会收敛到同一件事,所以在第七行可以拍摄Q S T,1 a t加1 b s t加1,是呀。
谢谢。都应该是你,谢谢你的接球,这可能是一个命名问题,但你说的是它如何从未来的行动中获取信息,但你必须已经做了那个动作,那它为什么叫,州行动奖励下一个州行动,当它真的是过去的,从我所了解的情况来看。
你正在更新,因为你在做这个,你用你学到的信息来更新后面的信息,那么为什么,我们为什么要谈论它,就像这是未来的行动,这就是那样做的目的,嗯,我不认为问题是关于用来定义我们集合的特定术语,我不这么认为。
我是说,我想这真的只是,你得等到你得到那个,最后一个A很重要,所以与其说,但在我们看到TD学习之前,你在一个州的行动奖励下一个州,然后你现在就可以更新你的Q函数了,我们只是说你必须等到。
你实际上已经决定了在下一个州做什么,因为这就是你的选择,怎么做,在这里更新您的Q函数,因为这是你为你的目标插入的,所以根据收敛性质,嗯,它需要几个不同的东西,呃,所以如果我们是,嗯,我们需要两样东西。
我们需要一个事实,我们正在更新我们的Q函数,它会逐渐更新,就像我们之前说的,我们需要一些关于阿尔法的条件,如果alpha等于1,一般来说你的Q函数不会收敛,因为这意味着你不记得过去的任何事情,嗯。
如果alpha为零,那你就不再更新了,所以通常你需要一些步骤大小方面的东西,它允许你慢慢地增加,但仍在汇聚,所以这些是一组充分条件,嗯,所以如果你有像alpha t这样的东西,等于1/。
Don’现在不行,根据经验,你经常会想要选择非常不同的学习率形式,所以阿尔法T通常被称为学习率,参数,从经验上看,你通常不会想用这个,一般不会用这个,这将是一个是的,你经常会想用不同的东西。
经验上你可以,你最终会使用有时很小的常数或慢慢衰减的常数,它通常取决于域,但这是从理论上讲的,什么足以确保趋同,另一个方面是你的方式,你的保单本身必须满足欢乐的条件,这意味着随着时间的推移。
你会慢慢变得更加贪婪,但你这样做在某种程度上,您仍在对所有状态操作对进行采样,无限次,现在请注意,这并不总是可能的,像这样,如果您有域,嗯,我的东西够不着的地方,在一个点之后,这不是诡辩。
你到了那里就不能回到某些状态,假设你在驾驶一架直升机,你把直升机弄坏了,所以你不能回到那里,那你就不能满足欢乐合唱团了,因为在某个时候你弄坏了你的直升机,然后,就像你不知道。
如果你继续在空中驾驶你的直升机会是什么样子,所以可能会有一些很难满足的领域,欢乐合唱团,嗯,但我们通常会忽略这些,尽管有一些非常有趣的工作,我们如何处理这些案件,在这种情况下。
你可能会认为这更多的是一个偶发的问题,所以也许你有一百架直升机,所以当你撞毁一个被认为是终止条件的,然后你拿出你的下一个,嗯,所以你可能会也可能不会在信息的限制下贪婪,在无限探索的极限中。
但你可以有一定的探索量,我们以后会更多地讨论,如何以更聪明的方式进行探索,以一种可以给我们有限样本保证的方式,我们需要多少数据来学习一个好的政策,这就是我之前说的,也就是,你知道的。
我们一般不会在帮助下使用步长,这是假设我们更新的一种特定形式,这就是你有s,t,a,t,plus,alpha的q,加1减去α次,正确的,是呀,好的,是啊,是啊,所以这是,这是给莎莎的。
这就是RSA的条件,假设,我们如何更新Q函数的特殊更新,好的,所以是的,菜单,所以在蒙特卡洛的案例中,我们有足够的条件,就像Pi t是令人满意的,就像Epsilon下降了一个,我们一般有类似的吗?嗯。
很好的问题,呃,问题是关于它的,为了蒙特卡洛,我们有类似的情况吗,如果你只是,嗯,如果你是第一次来,光是这一点就足够了,因为你得到了一个无偏的估计器,这是你所有回报的汇聚。
所以只要你访问所有的状态操作对,无限次,如果你是以这种渐进的方式做的,嗯,那么如果你,如果你是,如果你在玩弄阿尔法是怎样的,然后你需要有类似的条件来确保它保证,你觉得怎么样,你怎么知道一个人持有的条件。
你怎么知道事情是欢乐的,是啊,是啊,就像在蒙特卡洛,我们确实有个条件对吧,那就是Epsilon的腐烂是其中一件事,哦,所以我有一个很大的问题,所以本就像,你怎么确保事情是欢乐的,一个充分条件是ε大于1。
h是t的一比还是t的一比,你知道吗,Epsilon序列的相似表征,就像,是啊,是啊,哦,你的意思是,就充分条件而言,像这样,是啊,是啊,就像,会很欢乐,当且仅当ε为零,但有一些分歧或类似的东西,是啊。
是啊,我想它给同样的知更鸟定价,蒙罗序列,就像你本质上是,你是,你在确保,你在做无限次的更新,无限多的随机探索仍然以足够快的速度下降到会聚,我想可能完全一样,但我可以,好的,那么当我们进入Q学习时。
这与问题有关,我们只是问嘿,我们为什么要选择下一个特定的行动,我们为什么不选最大值呢,是啊,是啊,我们可以选择最大值,所以莎莎选择了这个特殊的下一个动作,Q学习是选择下一个最大动作。
我们把它们混合在一起因为你说星际争霸一开始会做得更好,因为它不是那么乐观,Q学习以后更好,所以那些任务我们是否可以混合萨尔萨和Q学习你当然可以,但这也让我意识到,也许我对前面的部分说得不够清楚。
早期在某些领域可以做得更好的明星,尤其是如果有很多真正负面的回报,因为这是现实的,嗯,在其他情况下,Q学习在早期就会更好,因为你可以,你变得更乐观了,正如我们之前谈到的,通常乐观对探索真的很有帮助。
悬崖散步,在萨顿和巴托的例子中,一些行为导致代理人喜欢,从悬崖上摔下来,所以有些行为真的很糟糕,所以他们很早就很乐观,意味着你会做出很多非常糟糕的决定,并在一段时间内遭受大量的负面回报。
许多其他领域都不是这样的,所以这取决于什么,但是是的,你当然可以把它们混合在一起,所以我想就Q而言,学习一件有趣的事情,这里是,嗯,所以我们可以再次思考我们如何改进这一点,我们会有点贪婪。
关于最优q的当前估计,这真的和我们在索萨做的很相似,除了现在我们更新这个Q的时候,我们真的要做这个麦克斯,所以s,t,a,t的q等于前一个值,外加阿尔法奖励,加最大值,所以现在还要注意。
您可以更早地更新它,因为你不必等到下一个动作,所以你只需要观察这一部分,你不需要真正看到所采取的下一个行动,然后您可以执行策略改进,一般来说,在这种情况下,你只在里面。
您只需要为您刚刚处于的状态更新策略,所以你可以做圆周率,您可以为ST更新Pi B,为了你刚才采取的行动,你不需要,尤其是在大的状态空间中,这可能会有所帮助,所以我们实际上已经讨论了一点。
关于如何初始化Q是否重要,它不是渐近的,我是说,如果你有一个Q函数是,会汇聚到正确的事情上,它仍然会聚到正确的地方,不管你怎么初始化它,嗯,所以如果它满足这些其他条件,但从经验上来说,这肯定很重要。
所以,尽管我们经常认为只是随机初始化它,或者用零初始化它,乐观地初始化它通常真的很有帮助,所以当我们谈到探索时,我们会更多地讨论这一点,是啊,是啊,上一张通过armax上的max到第6行的幻灯片,谢谢。
是呀,谢谢。谢谢。所以现在,嗯,如果我们做Q学习,嗯,让我们看看,我想我要离开的是,这只是你以后可以做的练习,但你可以在Q学习中做完全相同的练习,并查看这些更新是如何传播的,就像蒙特卡洛对Q一样。
蒙特卡罗与TD的政策评估,Q学习也有一些相同的问题,Q学习只会更新你的Q函数,你刚进来,所以即使在同一集的后面你会得到很高的奖励,你不会回去的,在这一集结束时传播该信息,就像你对蒙特卡洛一样。
所以Q学习更新通常比蒙特卡洛慢得多,就像,所以这意味着你能多快学会做出更好的决定,所以足以确保Q学习与D收敛的条件,基本上和萨索一样,我们需要确保事情是,实际上稍微修改一下这个。
所以如果你只是想确保你收敛,那么你需要无限频繁地访问所有的文章,你需要在阿尔法上有这些条件,所以如果你看相同的条件,以便Q函数收敛,你需要有这些关于你如何更新你的赞的条件,你的学习速度是多少,嗯。
你无限频繁地访问所有的状态动作对,但那不是,嗯,这足以让你收敛到最佳Q值,然后呢,如果你想确保,你所遵循的政策确实是最佳政策,那你就需要欢乐,因为你也需要你选择的政策越来越贪婪,所有的权利。
在我们结束之前,让我简单地讨论一下最大化偏差,所以最大化偏差是一个有趣的问题,嗯,那么我们为什么要谈论这口井,好的,让我们回到这个,嗯所以在Q学习中,我们在做什么,Q学习,我们在计算Q函数。
然后我们就贪婪了,现在我们得到了更多的数据,我们正在更新我们的Q函数,我们对此很贪婪,所以我们对它很贪婪,所以我们总是在更新东西之间跳舞,获取更多证据,然后试图利用这些知识,直到一些随机的探索。
最大化偏差指出,这可能会有一些问题,好的,所以让我们考虑一个特定的例子,想象有一个单一的状态,mdp,这意味着只有一个州,嗯,但是有两个动作,它们实际上都为零,平均随机奖励。
所以现在你可以把这些看作是高斯函数,现在我们主要是在谈论它,当奖励实际上是确定性的,但不一定是,可能是随机奖励,但在这种情况下,我们会想象,无论你采取一个动作还是一个动作,你的期望值为零。
但是你在任何一集里得到的价值,任何特定的步骤都可能不是零,可能是,你知道一个或减去一个,或者类似的东西,平均值仍然是零,但在任何特定的步骤中,你都可以有不同的东西,但期望值为零,嗯。
所以两者的q值都是1,s,a,2的q值为零,这与价值相同,这些就是你所知道的,最佳Q和S值,所以让我们想象一下有一些先前的样本,你已经试过很多次了,你已经试过很多次了,你计算一个经验估计,又在这里。
在那里嗯,只有一个州,我们可以平均这些,所以让我们想象一下,我们有一个超级简单的,嗯,伽马等于零,所以我们真的只是在估计眼前的回报,所以没有未来的奖励,我们只是说我们以前尝试过这种行动的所有时间。
我们得到的所有奖励是什么,我们平均,现在我们要做的是,我们想对Q函数进行经验估计,为了一个一和一个二,我们想弄清楚贪婪的政策是什么,问题是这可能会有偏见,所以即使Q的每一个无偏估计量本身。
即使对行动的两个估计是无偏的,当你把最大值超过它的时候,它可能会有偏见,所以让我们把它写出来,所以RV I HAT等于max的期望值,我也是,所以我要取这两个东西的最大值的光谱。
因为我就是这样定义我的政策的,我的政策是,从经验上看,这两个中的哪一个看起来最好,但我们从詹森那里知道,这大于等于,如果你切换最大值和期望值,这正好等于零的最大值,所以重要的是这个,所以这等于真Vπ。
这意味着无论我们计算什么,um可以是真V pi的有偏估计器,为什么这会发生得很好,如果你得到一个,你知道如果你只有有限数量的样本,嗯,我如果我试过一个动作,有限次数,它可能在有限的次数上。
它碰巧看起来有点积极,就像零点一样,一个而不是零,然后当我拿着我的保单,我要最大化那些,所以我要立即利用哪一个碰巧看起来更好,即使这是统计上的机会,所以这就是为什么你可以得到这个最大化偏差。
同样的事情也可能发生在MDPS方面,所以嗯,这通常会发生,你也可以看看约翰的这篇论文中的一些很好的例子,约翰在无厚,um和shymanor,他们展示了马尔可夫决策过程中也会发生这种情况,基本上,如果你。
呃,如果你是对这些Q函数的估计,那么你就会对所发生的事情有偏见,在你的数据中看起来很好,所以你可以有一个最大化偏差,所以有一件事被提议试图处理,处理这种情况叫做双Q学习,所以这个想法是代替一个Q函数。
我们将有两个不同的Q函数,我们将创建Q的两个独立无偏估计器,你要用其中一个来做决定,另一个试图估计价值,这将允许我们有一个无偏的估计器,你想这么做的原因是,因为这样它就可以帮助解决这个问题。
你最终可能会对那些碰巧看起来很好的东西过于偏见,但现在你们有点分离,就像你要去的样本之间,你要估计的,一个动作有多好,与你试图估计你的政策的方式相比,所以我就长话短说了,因为时间,Q基本学习,双倍。
q学习基本上意味着我们将有这两个不同的q函数,嗯,然后有百分之五十的概率我们会更新百分之一百五十的概率,我们要更新另一个,所以这个会,在这种情况下,我要跳过,我会在最后的幻灯片中加上这个。
我想让你看看区别,嗯,所以这里的差异可能是显著的,有时候,所以在这种情况下,这是在看时间的百分比,我们在这个领域采取了不好的行动,在这种情况下,你会有一个场景,这实际上是错误的做法,但它是随机的,因此。
只要有少量的数据,它最终会更好看,与另一种选择相比,奖励是确定性的,实际上更好,但没有随机性,然后Q学习会受到这种最大化偏差的很大影响,嗯,如果您使用相同的Q函数来立即定义您的策略。
就像你估计保单的价值一样,而双Q学习做得更好,在这种情况下,因此,当你实施这些事情时,这是需要考虑的事情,开销也很小,因为你可以保持两个不同的Q函数,我知道这有点快,我会确保把细节写在里面,嗯。
我当我我们上传额外的幻灯片今天,嗯,从今天开始你应该知道的主要事情,就是能够理解你是如何在政策控制上做到这一点的,Sasa和Q学习也是如此,了解它们更新的速度是很有用的。
我都在考虑你是否要等到这一集结束,然后信息传播回来的速度有多快,然后了解如何定义算法上的条件。
P5:Lecture 5 - Value Function Approximation - 大佬的迷弟的粉丝 - BV1Cc411h7QQ
All right, good morning。
We’re going to go ahead and get started。 Homework 1 is due today, unless you’re using late days。
And homework 2 will be released today。 Homework 2 is going to be over function approximation and reinforcement learning。
We’re going to start to cover that material today, and then we’ll continue next week。
with deep learning。 Deep learning is not a prerequisite for this class。
and so we’re going to be releasing, a tutorial on TensorFlow later this week。
And then next week we’ll also in session have the opportunity to go into some more of。
the background of deep learning。 You’re not expected to be an expert。
but you need to know enough of it in order to do the, homework and do the function approximation。
We will be assuming that you’re very familiar with things like grading the scent and taking。
derivatives and things like that。 TensorFlow and other packages can do that automatically for you。
but you should be familiar, with the general process that happens。
Before we continue to then we may have any logistic questions。 Alright。
let’s go ahead and get started。 As you can see, I have lost my voice a little bit。 It’s coming back。
but we’ll see how we go and if it gets too tricky then we’ll take, over。 Alright。
so what we’ve been talking about so far is thinking about learning to be able。
to evaluate policies and sequential decision making cases and being able to make decisions。
All of this is when the world is unknown and what I mean by that is that we’re not given。
in advance a dynamics model or a reward model。 What we’re going to start to talk about today is value function approximation。
Just so I know actually who have you seen this before?
Who’s seen some form of value function approximation? Okay, so a couple people but most people know。
When I say value function approximation, what I mean is that so far we’ve been thinking。
about domains where we tend to have a finite set of states and actions and where it is。
computationally and memory feasible to just write down a table to keep track of what the。
value is of states or the value of state action pairs or that we could imagine writing。
down a table to write down the models explicitly of the reward model and the dynamics model。
But many real world problems have enormous state and action spaces。
So if you think about things like the Atari games, which we can debate about whether or。
not that’s a real world problem but it’s certainly a challenging problem。
the state space we discussed, at the beginning is really sort of a set of pixels。
And so that’s going to be an enormous space and we’re not going to be able to write down。
that as a table。 And so in these cases we’re going to have to go beyond sort of this tabular representation。
and really think about this issue of generalization。
So we’re going to need to be able to say we want to be able to make decisions and learn。
to make a decision and we’re going to need to be able to generalize from our prior experience。
so that even if we end up in a state action pair that we’ve never seen exactly before。
it’s like a slightly different set of pixels than we’ve ever seen before that we’re still。
going to be able to make good decisions。 And that’s going to require generalization。
So what we’re going to talk about today is we’re starting with value function approximation。
for prediction and then talk about control。 And the kind of the key idea that we’re going to start to talk about in this case is that。
we’re going to be representing the state action value function with a parameterized function。
So we can think of now as having a function where we input a state and instead of looking。
up in a table to see what its value is, instead we’re going to have some parameters here。
So this could be a deep neural network。 This could be a polynomial。
It could be all sorts of different function approximations but the key here is that we。
have some parameters that allow us to say for any input state, what is the value?
And just like we saw before, we’re going to both sort of go back and forth between thinking。
of there being a state value function and a state action value function。
And the key thing now is that we have these parameters。
We’re mostly going to be talking about those parameters in terms of W。
So you can generally think of W as just a vector where that vector could be the parameters。
of a deep neural network or it could be something much simpler。 So again, why do we want to do this?
And sort of what are the forms of approximations we might start to think about?
So we just don’t want to have explicitly store, learn for every individual state action pair。
So we don’t have to do that in terms of learning a dynamics model。
We don’t have to do that in terms of a value function or state action value function or。
even in terms of a policy。 We’re going to need to be able to generalize so that we can figure out that our agents。
our algorithms can figure out good policies for sort of these enormous state spaces and。
action spaces。 And so we need these compact representations。 So once we do this。
we’re going to get multiple different benefits。 There were also going to incur potential problems as well。
So we’re going to reduce the memory that we need to store all of these things。
We’re going to reduce the computation needed and, we might be able to reduce the experience。
And so what I mean by that there is how much data does our agent need to collect。
in order to learn to make good decisions。 So this is really a notion of sort of how much data is needed。
Now I just want to highlight here that they can be really bad approximations。
And those can be great in terms of not leaving a lot of data and。
not needing a lot of computation and not needing a lot of memory。
But they may just not allow you to represent very good policies。
So these choices of representation are defining sort of hypothesis classes。
They’re defining spaces over which you can represent policies and value functions。
And so there’s going to be sort of a bias variance trade off here and。
a function approximation trade off in the sense that if you have a very small representation。
you’re not going to need very much data to learn to fit it。
But then it’s also not going to have very good capacity in terms of representing。
complicated value functions or policies。 So as a simple example。
we could assume that our agent is always in the same state, all the time。
All video game frames are always identical。 And that’s a really compressed representation。
We only have one state, but it’s not going to allow us to learn to make different。
decisions in different parts of the game。 So it’s not going to allow us to achieve high reward。
So there’s going to generally be a trade off between the capacity of the representation, we choose。
So sort of the representational capacity。 Versus all these other things we would like versus memory。
computation and data。 Now there isn’t always sometimes one gets lucky and。
you can choose something that’s very, very compact and。
still sufficient to represent the properties you need to represent in order to make good, decisions。
But it’s just worth thinking that often there’s this explicit trade off and we often don’t。
know in advance what is a sufficient representational capacity in order to achieve high reward。
Yeah。 >> Is this more or less than orthogonal consideration from the bi-estarian’s trade off。
in a functional representation? >> Yeah, and you can think of it as a question as whether this is an orthogonal。
trade off to sort of bi-estarian’s trade off。 Good make up is related。
If you choose a really restricted representational capacity, you’re going to have a bias forever。
because you’re just not going to be able to represent the true function。
So it’s and they’ll have considered a smaller variance for a long time because it’s a smaller。
representation。 So it’s related to related to that。
If you take a machine learning and talk about things like structural risk minimization and。
thinking about how you choose your model class capacity versus how much data you have in。
terms of minimizing your test center, similar to that too。
So how do you trade off in terms of capacity to generalize versus the expressive power? All right。
So a natural immediate question that I’ve started alluding to already is what function。
approximation are we going to use? There’s a huge number of choices。
Today we’re only going to start to talk about one particular set but there’s an enormous。
number and probably most of the ones you can think of have been tried with reinforcement, learning。
So pretty much anything that you could do in supervised learning, you could also try as。
a function approximator for your value function。 Could be neural networks or deep decision trees or nearest neighbors。
wavelet bases, lots of, different things。 What we’re going to do in this class is mostly focus on things that are differentiable。
These are nice for a number of reasons but they tend to be a really nice smooth optimization。
properties so they’re easier to optimize for。 That’s one of the reasons we’re going to focus on them in this class。
Those are not always the right choice。 Can you make me an example of where for those of you that are familiar with decision trees。
where you might want a decision tree to represent either your value function or your policy? Yeah。
They tend to be how they interpret both and keep them supportive but it’s also a treat。
In the case we need to explain it to people that need to actually understand that’s feasible。
Exactly。 What’s just said is that depending on how you’re using this reinforcement learning policy。
this may be interacting directly with people。 Let’s say this is going to be used as a decision support for doctors。
In those cases having a deep neural network may not be very effective in terms of justifying。
why you want a particular treatment for a patient but if you use a decision tree those。
tend to be highly interpretable。 Depending on which features you use but often it’s pretty highly interpretable and so that。
can be really helpful。 Thinking about what function approximation you use often depends on how you’re going。
to use it later on。 There’s also been some really exciting work recently on explainable deep neural networks。
where you can fit a deep neural network and then you can fit a simpler function approximator。
on top so you can fit your deep neural network and then try to fit a decision tree to it。
You try to get the best of both worlds super expressive function approximator and then still。
get the interpretability later。 It’s worth thinking about the application that you’re looking at because different ones。
will be more appropriate in different cases。 Probably the two most popular classes these days and in RL in general are linear value function。
approximation and deep neural networks。 We’re going to start with linear value function approximation for two reasons。
One is that it’s been probably the most well studied function approximator in reinforcement。
learning but up to the last few years。 And second is because you can think of deep neural networks as computing some really complicated。
set of features that you’re then doing linear function approximation over at least in a。
number of cases。 So it sort of provides a nice foundation for the next part anyway。 Alright。
so we’re going to do a really quick review of gradient descent because we’re going。
to be using a ton over the next few days。 So let’s just think about any sort of general function J which is a differentiable function。
of a parameter vector W。 So we have some vector W。 It’s going to be a set of linear weights soon。
And our goal is to find the parameter W that minimizes our objective function。
I haven’t told you what the objective function is but we’ll define it shortly。
So the gradient of J of W is we’re going to denote that as delta J of W。
And that’s just us taking the derivative of it with respect to each of the parameters。
inside of the vector。 And so that would be the gradient。
And so a gradient descent way of trying to optimize for a function J of W would be to。
compute the derivative or the gradient of it and then to move your parameter vector。
in the direction of the gradient。 So if your weights and generally we’re going to always assume the weights are a vector。
are going to be equal to your previous value of the weights minus some learning rate of。
the derivative of your objective function。 So we’re just figuring out the derivative of our function and then we’re going to take。
a step size in that and move our parameter weights over a little bit and then we’re。
going to keep going。 So if we do this enough times are we guaranteed to find a local optima? Right。
so they’re maybe some conditions on the learning rate。 Yes。
if we do this enough we’re guaranteed to get to a local optima。 Now, notice this is local。
So when we start thinking about this in terms of the policy in terms of doing RL it’s important。
to think about where we’re going to converge to and if we’re going to converge。
And I’ll talk more about that throughout class。 So this is going to be sort of a local way for us to try to smoothly start changing our。
parameter representation of the value function in order to try to get to a better approximation。
of it。 Alright, so let’s think about how this would apply if we’re trying to do policy evaluation。
So again, policy evaluation is someone’s given you a policy, they’ve given you a mapping。
of first date what your action is and this could be stochastic。
So it could be a mapping from states to a probability distribution over actions。
So but someone’s given you a policy and what you want to do is figure out what’s the value。
of that policy。 Was they expected discount of some of rewards you get by following that policy?
So let’s assume for a second that we could query a particular state and then an oracle。
would just give us the value, the true value of the policy。 So I ask you like, you know。
what’s the expected discount of some of returns for starting in。
this part of the room and trying to navigate towards the door under some policy and it, says, okay。
the expected discounted number of steps it would take you is on average like, 30, for example。
So that would be a way that the oracle could return these pairs and so you’d get sort。
of this pair of S the pi of S。 And then let’s say given that we have all this data what we want to do is we want to fit a。
function we want to fit our parameterized function to represent all that data accurately。
So we want to find the best representation in our space of the state value pairs。
So if you frame this in the context of stochastic gradient descent what we’re going to want to。
do is just directly try to minimize our loss between the value that we’re predicting and。
the true value。 So right now imagine someone’s giving us these true S value pairs and then we just want to。
fit a function approximator to fit that data。 So it’s really very similar to doing sort of supervised learning and in general we’re。
going to use the mean squared loss and we’ll return to that later。
So the mean squared loss in this case is that we’re just going to compare the true value。
to our approximate value and our approximate value here is parameterized by our vector of。
parameters。 And we’re just going to do gradient descent。
So we’re going to compute the derivative of our objective function and when we do compute。
the derivative of that then we’re going to take a step size and we’re going to do stochastic。
gradient descent here which means we’re just going to sample the gradient。
So what I mean by that is that if we take the derivative of our objective function what。
we would get is we’d get something that looks like this。
And what we’re going to do is we’re going to take, I’m going to use this as shorthand。
for updating the weights。 We’re going to take a small step size in the direction of this as evaluated for one single。
point。 So now there’s no expectation and this is just for a single point。
So this is stochastic gradient descent where we’re not trying to compute the average of。
this gradient。 We’re going to, we’re trying to just sample this gradient evaluated at particular states。
And what I’ve told you right now is that someone’s given us these pairs of states in the true。
value function。 So you just take one of those pairs。
compute the gradient at that point and then update, your weight function and do that many。
many times。 And the nice thing is that the expected stochastic gradient descent is the same as the full gradient。
update。 So this has nice properties in terms of converging。 Yes, a name first please。
So just to confirm why is the expectation over a policy and not over a set of states。
if you were saying that SGD is a single state? So this is over the distribution of states that you’d encounter under this policy。
Question was why do it over what does the expectation mean in this case?
In this case it’s the expected distribution of states and values you’d get under this, policy。
And that’s an important point。 It’ll come up again later in terms of what is the distribution of data that you’re going。
to encounter under a policy。 Of course in reality we don’t actually have access to an oracle to tell us the true value。
function for any state。 If we did we would already know the true value function and we wouldn’t need to do anything。
else。 So what we’re going to do now is talk about how do we do model-free function approximation。
in order to do prediction evaluation without a model。 Okay。
so if we go back to what we talked about before we thought about either these sort of。
Monte Carlo style methods or these TD learning style methods where we could adaptively learn。
online a value function to represent the value of following a particular policy。
And we did this using data。 And we’re going to do exactly the same thing now except for we’re going to have to whenever。
we’re doing this sort of update step of updating our estimator with new data we’re also going。
to have to do function approximation。 So instead of just like incrementally updating our table entry about the value of a state。
now we also have to re-approximate our function whenever we get new data。 Alright。
so when we start doing this we’re going to have to choose a feature vector to, represent a state。
Let me just ground out what this might mean。 So let’s imagine that we’re thinking about a robot and a robot that well robots can have。
tons of really amazing sensors but let’s imagine that it’s old school and it just has a laser。
range finder。 A lot of laser range finders used to basically be 180 degrees and so you would get distance。
to the first obstacle that you hit along all of this 180 degrees。
So maybe here it’s like two feet and this is 1。5 feet, this is 7 feet and it sort of。
gives you an approximation of what the wall looks like for example。
So here’s our robot it’s giving it it’s got a sensor on it which is a laser range finder。
and it’s telling us the distance to all of the walls and so what would this feature representation。
be in this case it would just be simply for each of these 180 degrees what’s the distance。
at 1 degree? 2 degree。 That would be an example of a feature representation。
Now why that sounds like a pretty good, maybe slightly primitive but generally a pretty good。
feature representation but what’s the problem with that? Well, probably isn’t Markov。
So a lot of buildings have hallways that would say on my left and my right there’s a wall。
about two feet away and then there’s nothing in front of me at least for perhaps out to。
my laser range finder who would just say out of range and that would be true for many different。
parts of the same hallway and it would be true for many different hallways and so there’d。
be a lot of partial aliasing。 So this is a feature representation that probably is not Markov but it might be reasonable。
It might be a reasonable one on which to condition decisions maybe if you’re in the middle of。
the hallway and that’s what it looks like you always just want to go forward。
That’s an example of the type of feature representation and again just emphasizes the。
point that the choice of the feature representation will end up being really important。
And for those of you who have taken deep learning classes you’ve probably already heard this。
but it’s kind of a four deep learning and there was often a huge amount of work and there’s。
still a huge amount of work on doing feature engineering to figure out what’s the right。
way to write down your state’s face so that you can make predictions or make decisions。
Now one of the nice things about deep neural networks is that it kind of pushes back that。
feature selection problem so that you can use really high dimensional sensor input and。
then do less amount of hand tuning。 So what do I mean by hand tuning?
Well in this case you know you could use the raw features about like how far you are to。
on each of these 180 degrees or you can imagine having higher level abstract features like。
trying to understand if there are corners。 So you could already have done some pre-processing on this raw data to figure out what features。
you think might be relevant if you’re going to make decisions。
And the problem with doing that is that again if you pick the wrong set you might not be。
able to make the decisions you want。 Yes the name first please。
Could you please elaborate why this is not Markov? It’s getting the 180 degrees。
Yeah so the question is can I elaborate why this is not Markov?
If you just have 180 degrees for a robot if you think about something say like a long。
hallway let’s say this is floor one this is floor two like in gates for example。
So if you have your little robot that’s walking along and it’s guiding its laser range finder。
it’s trying to tell it’s the distance to all of the things you’re not going to be able。
to distinguish with that representation whether you’re on floor one or floor two because your。
immediate sensor readings are going to look identical。
And in fact you’re not going to be able to tell where you are on that hallway from its, hallway。
Yeah。 So can we generalize that if we have partial aliasing then we say it’s more and more fun。
Great question。 Can we generally say if we have partial aliasing it’s not Markov? Yes。
I mean you could change this state representation to be Markov by including the history and so。
then each individual observation would be aliased but the whole state representation。
would not be but in general yes if you have a state representation for which there’s aliasing。
it’s not Markov。 It might still be that you can still do pretty well with that representation or you might。
not but it’s just good to be aware of in terms of the techniques one is applying。 Good question。
Alright so let’s think about doing this with linear value function approximation。
So what do I mean by linear value function approximation it means that we’re simply going。
to have a set of weights and we’re going to dot product this with a set of features。
So you know maybe it’s my 180 degree sensor readings and then I’m just going to have。
a weight for each of those 180 features。 And we can either use that to represent a value function or you can do that for a state。
action value function。 Those of you who already think about state action value functions might notice that there’s。
at least two ways to do that once you start getting into Q just mention that briefly。
You could either have a separate weight vector for each action or you could put the action。
as sort of an additional feature essentially multiple different choices you get different。
forms of sharing。 But right now we’re just thinking about estimating the value of a particular policy so we’re just。
going to think about values and we’re going to say that remember W is a vector and X is。
a vector now。 X of S is just going to give us the features of that state。
So it could be like the real state of the world is where the robot is and the features。
you get out are those 180 readings。 So we’re again going to focus on mean squared errors。
Our objective function is this mean squared error the difference between the values we’re。
predicting and the true values。 And this is our weight update which is we want to update our weight by a learning rate。
times the derivative of this function。 So what does this look like in the case of linear value function approximation?
So what we’re going to do is we’re just going to take the derivative of J using the fact。
that we know that this is actually X times W。 So what we’re going to get in this case is W delta W is equal to so I’m going to have。
alpha to v pi of S minus v hat of S W times X because the derivative of X times W with。
respect to W is X。 Yes? The value over all states are for a particular state。 Great question。
I’m going to give you one more time。 Yes。 So this question is this is an expected value over all states or a particular state when。
we’re doing the update of the W we’re going to be evaluating this at one state。
So we’re going to do this for each state。 We’re going to see different algorithms for it but generally we’re going to be doing stochastic。
gradient descent so we’re going to be doing this at each state。
The expected value here you can think about is really over the state distribution sampled。
from this policy。 So if you were to execute this policy in your real MDP you would encounter some states。
And if you and we’ll talk shortly more about what that distribution looks like but that’s。
the we want to minimize our error over all over the state distribution we would encounter。
under that policy。 Check out questions。 Okay so if we look at this form what does this look like it looks like we have a step。
size which we’ve seen before with CD learning and then we have a prediction error which is。
the difference between the value function the true value function and the value function。
we’re predicting under estimator and then we have a feature value。
So that’s one of the nice aspects of linear value function approximation is that these。
updates form into this sort of very natural notion of how far off were you from the true。
value weighed by the features。 Yes。 >> So you could question on the math here so that you have the negative the gradient until。
you use the negative one half out that that’s a gradient right now but you have a negative。
inside the minus minus half。 So does the it should be a negative excess there with the negative one half out on the。
left side as well。 >> You can push this into either so question is about just being careful about the negatives。
that come out。 Yes you could push that negative out into here in general alphas a constant so you can flip。
it and be positive or negative generally you’re going to want your if you’re minimizing。
this it’s going to be you’re going to be subtracting this from the weights but you just want to。
be careful of depending on how you’re defining your alpha to make sure you’re taking gradient。
sense gradient steps in the right direction。 >> Good question。
Okay so how would we do this remembering again that we don’t actually have access to。
the true value function so we don’t actually know so in this equation right this assumes。
this is true。 Like this is if the Oracle has given you the value of a state under that policy but of。
course we don’t have access to that。 So what we’re going to do is sort of use the same types of ideas as what we saw in tabular。
learning now with the value function approximation。
So the return which is the expected or the return which is the sum of rewards from time。
step t till the end of the episode is an unbiased but noisy sample of the true expected return。
for the current state where in on time step t。 And so we can think about doing Monte Carlo value function approximation as really as if。
we’re doing supervised learning on a set of state return pairs。
So now what we’re doing here is we’re substituting in GT as an estimate of the true value。
So we don’t know what the true value is but we know that the Monte Carlo return is an unbiased。
estimator so we’re going to substitute that in。 Okay so what does that mean if we’re doing linear value function approximation it means。
inside of our weight update we have a G here。 So we would take the state we would take the sum of rewards on that episode so again this。
it can only be applied in episodic settings just like generally with Monte Carlo and then。
we take the derivative and in this case that’s just X our features because we’re using。
a linear value function approximation and then on the last line I’m just plugging in exactly。
what our V hat estimator is。 So we’re comparing our return to our current estimator and then we’re multiplying it by。
our features and as usual we have the problem that G might be a very noisy estimate of the, return。
Yes the name first please。 Do we differentiate first time and every time before?
Do we differentiate first time and every time before? Great question。
Do we distinguish between first time visit and every time visit? Yes。
The same exact distinctions apply to Monte Carlo obtaining that applied before。
So on here I’m showing a first visit variant of it but you could also do every visit and。
it would have the same strength and limitations as before。
Every visit is biased asymptotically it’s consistent。
Okay so what does the weights look like in this case?
We would say weight is equal to the old weights plus alpha times e t of s minus v at the best, w。
Remembering that this is just X times w for that state times X of s。
So it’s very similar to what we saw before for Monte Carlo policy evaluation。
What we do is we start off in this case now instead of having a value function we just。
have a set of weights which is going to now be the zero vector to start。
Then we sample an episode we have to sample all the way to the end of the episode using。
the policy and then we step through that episode and if it’s the first visit to that state then。
we compute the return from that state till the end of the episode and then we update our, weights。
Yeah。 Just to check the path are you adding the learning rate because of the negative and。
the pretty weight? Just a quick question is about the alpha where oh in terms of negative versus positive。
Right。 Just one or two or three。 Yes so in general this is going to look like this。
I’m going to be a little bit loose on those。 Alpha is going to be a learning rate that’s a choice。
And finally we’re going to be trying to minimize our objective function and we’re going to be。
reducing our weights。 And we’ll need to be able to be a little bit careful about how we pick alpha over time。
And this is being evaluated at each of the states that we encounter along the way。
And just be careful on step six, you know, after or just adding up with no distance。 Good question。
On step six, I was it。 Well sorry said do we need to have a gamma function?
It’s a good question in episodic RL you can always get away with gamma being one。
So if it’s an episodic place, gamma can always equal one。 It is also fine to include gamma here。
So here generally in episodic cases, you will set a gamma being equal to one because one。
of the reasons why I said our gamma to be less than one is to make sure things are bounded。
in terms of their value function。 But in the episodic case, it is always guaranteed to be bounded。
But it is also completely fine to include a gamma here。
So I kind of have a question about the same point about this g。 So when we do that。
it seems like we will end up sampling g’s that have rewards over, episodes of different length。
So doesn’t that pose their distribution in all stationary and long variance? Questions。
but there’s a problem with the fact that the returns you’re taking are going。
to be sums over different lengths。 It isn’t。 So you’re always trying to estimate the value of being in this state。
which itself under, this policy。 And in the episodic case。
you might encounter that state early on in the trajectory or late, in the trajectory。
And your value is exactly going to be averaged over whether you encountered it early or late。
in one of the returns。 There’s no problem with, we are assuming all of your episodes are bounded。
They have to be finite。 So there has to be with probability one, your episode has to end。
If that is true, then your rewards are always bounded。
And then you can always just average over this。 And that’s fine。
Sometimes you might encounter a state really early in the trajectory and have a lot of, rewards。
Other times you might encounter it at the end and have very few rewards。
And the value of it is the expectation over all of that。 Yeah。 Well, that’s just a clarification。
So, essentially, this algorithm you’re updating this little of the linear approximation of。
the episode。 So you start with an episode, it was a little, then you take that little new updated。
keep, it in the following episode。 And not just one, so to ask about it。
and you’re not just updating the wait once an episode, many times, right?
So you look at all the states you encountered in that episode, and for each of those you。
update your wait vector。 So you’re generating all the episodes and trying to fit them in a single。
That’s a good idea。 What if we did this in a batch setting?
So what if you generated all the data and then afterwards tried to fit it?
So this is an incremental approach to doing that。 And then I’ll end up converging to the same thing。
Okay。 Great。 Yeah。 Just when you include gamut, you should be gamut at the power of J minus T so that you。
start discounting, like going forwards。 Okay。 Good catch。 Again。
you shouldn’t need a gamma in this case。 So in general in this case。
there should be probably most of the time there be no gamma, in the episodic case。
but it’s good to be precise about these settings。 Okay。 All right。
So let’s think about this for a particular example。
It turns out that when we start to combine function approximation with making decisions。
and doing this sort of incremental update online, things can start to go bad。
And what I mean by bad is that we may not converge and we may not converge to places。
that we want to in terms of representing the optimal value function。 So there’s a nice example。
When people are really starting to think a lot about function approximation in the early, 1990s。
Baird came up with this example where it can illustrate some of the challenges of。
doing function approximation when combining it with doing control and decision making。
So we’re going to introduce this example now with doing MC policy evaluation and then。
we’ll see it a few times throughout class。 So what is this example showing? So in this example。
there are going to be two actions。 So A1 is going to be straight lines and those are all going to deterministically go to what。
I’m going to call state S7。 This is state S1, S2, S3, S4, S5, S6。
And what you can see inside of the bubbles there is what its feature value representation, is。
So remember I said that we would have a state and then we could write it down as a set of, features。
So what does S1 look like? It looks like two, two, three, four, five, six, seven。
So weight one is two and weight eight is one。 So what does S2 look like? S2 looks like zero, two。
one, two, three, four, five。 There we go。 S3 looks like this。
And so on until we get to S7 which looks like this。
So S7 looks a little bit different than the rest of them。
That is the feature representation of those states。
Now notice that it looks pretty similar to a tabular representation。
In fact there are more features than there are states。
So there are only seven states here and there are eight features。 That’s completely possible, right?
Like your feature representation could be larger than the number of true states in the, world。
So then we have action A1 and action A1 always takes us from any state deterministically to。
state S7。 And then we have action A2 which is denoted by dot dot dot dot。
And what action A2 does is with probability one over six it takes you to state S, I where。
I is in one to six。 So basically uniformly spreads you across one of the first six states。
So there are only two actions。 Either you deterministically go to state S7 or if you take the second action then you。
go to one of the first six states with equal probability。
It’s a pretty simple control problem because the rewards are zero。 Everywhere for all actions。
So the value function for this is zero because there’s no rewards anywhere and yet we can。
start to run into trouble in some cases。 So before we get to that part let’s first just think about what like a Magi Carlo update。
would do。 And let’s just imagine also that there’s some additional small probability here that from。
S7 that we actually go to a terminal state。 So like let’s say with probability 0。
999 we stay in S7 or 0。99 we stay in S7 and 0。01, we terminate。
And this is a slight modification but I’m doing that just so we can do it for the Magi, Carlo case。
So we can think of episodes ending。 So if you’re in state one through six you can either go to S7 or you can stay in states。
one through six。 If you’re in S7 you can either go to states one through six you can stay in S7 or you can。
terminate。 Alright so what might an episode look like in this case?
So let’s imagine that we were in state S1 we took action A1 that deterministically gets。
us to state S7。 Actually before I do that I’ll specify we got zero reward。
Word was zero we went to S7。 We took action A1 we got zero reward we stayed in S7 we took action A1 we got zero reward。
and then we terminate。 That’s our episode。 So now we can think about what our Monte Carlo update would be。
So our Monte Carlo update in this case would be let’s start with state S1 and try to do。
the Monte Carlo update。 So for state S1 the return is what? Zero。 Zero。 So the return is zero。
What is X? Oh and I should tell you。 So let’s start with initializing all of our weights to be one。
So what is our initial estimate of the value function of state S1? How many?
So it’s all of the weights are one。 The state S1 representation is two zero zero zero one three。
That’s right。 So and that’s just equal to our X times delete。
So then what does our update look like? And of course I would have to tell you what alpha is。
So let’s say alpha is equal to 0。5。 So what our weights are going to change in the weights is going to be equal to 0。
5 times, zero minus three times our feature vector for X。
Our feature vector for X is two zero zero zero zero one。
So that means that we’re going to get basically minus one point five times two zero zero one。
minus three times minus one point five。 So notice this is going to give us an update for every single weight。
But it’s only going to give us an update for the weights that are nonzero in this particular, state。
which is the first weight and weight eight。 And so then if we were to actually get the new weights。
so now we’re going to have w is, equal to w plus delta w。
Then our new representation would be minus two one two three four five six, minus point, five。
So that would be one update of Monte Carlo for the first state。
Now you would do this for every single state in that episode。
So you would then do it for the first time you see it in the algorithm I’ve defined before。
So we would next do this for state as seven as well。 Where the return would also be zero。
but the value would be something different。 So we would get a different well actually in this particular case。
the value is also three。 It depends on if you’ve already updated your w then your value will already be different。
Yeah。 So we’re doing SGD per state not perhaps。 Question is are we doing SGD per episode or state?
We did per state。 Yeah。 In the previous slide we had the fourth every state that every encounter does that mean that。
for every first visit in that episode。 So yes, and it’s within that specific episode。
So when you go to a new episode that would reset。 Question is about through this first visit。
We basically step along that episode similar to what we did with Monte Carlo before and。
the first time we’re going to encounter a state in that episode we update the weights using。
its return and when we do that for every single unique state in that episode the first time。
we see it and then after all of that we did a new episode。 Alright。
So this is what would happen and you can see that the changes can be fairly large because。
we’re comparing like the full return to our value function。
It depends of course on what our alpha is and alpha can change over time and generally。
we’ll want alpha to change over time in order to get convergence。
This gives an example of sort of what Monte Carlo updated would look like in this case。
with linear value function approximated。 Okay。 So a natural question might be does this do anything reasonable?
Are we guaranteed that this is going to converge to the right thing?
And what does the right thing mean here? We’re constrained by our linear value function approximator。
So we’re going to say are we going to converge just like the best thing in our linear value。
function approximator。 Okay。 Before we do this let’s just talk for a second about the distribution of states and how that。
influences the result。 So if you think back for maybe the first or second lecture we talked about the relationship。
between Markov processes, Markov reward processes and Markov decision processes。
And we said that once you define a particular policy then your Markov decision process is。
actually a Markov reward process where you can think of it as a chain where the next。
state is determined by your dynamics model where you only use the action according to, your policy。
So if you run that, if you run your sort of Markov chain to find by an MDP with a particular。
policy you will eventually converge to a probability distribution over states。
And that distribution over states is called the stationary distribution。
It’s a probability distribution it’s saying sort of like what percentage at the time are。
you going to be in state one on average versus state two, etc。
That’s the sum to one because it’s a probability distribution you always have to be in some。
state and it satisfies a balanced equation。 So it says that the probability distribution over states before some。
yeah I guess let me, just flip this I think it’s a little bit easier to think about it the other way around。
We’ve got d of s prime is equal to sum over s sum over a。
We’re just doing this sum over a right now so that we can be sure that we allow ourselves。
to have stochastic policies。 So we look at all the actions that we could take under the current state and then we look。
at where we could transition to on the next state。
So we are in some distribution over states we think of all the actions we could take。
from each of those states where we might transition to and then that gives us a new distribution。
over states s prime and those two have to be identical。
So this is often also thought about in terms of a mixing property when your Markov chain。
has run for long enough this balanced equation will eventually hold and this is just that。
your distribution over states on the previous time step has been exactly the same as your。
distribution over states on the next time step after this process is fully mixed。
And it’s just telling you on average you know how much time are you spending and what’s。
the probability on any particular time step you’re going to be in a particular state。
This is not telling us how long it takes for this process to occur。
So this depends a lot on the underlying dynamics of the system。
So it might be that this takes millions of steps until you reach the stationary distribution。
or it might mix pretty quickly depends on the properties of your transition matrix under。
the policy。 I’m not going to get into any of that in this class。
It’s just important to know that you can’t it’s not like you can just wait a hundred steps。
and definitely you’re going to be in the stationary distribution。 It depends on the problem。 Yeah。
Any of you。 Remember my meaning? Yeah。 Have you been putting bounds in the mixing plan?
Is my color measures? Well, there’s any proven bounds on the mixing time of these type of Monte Carlo methods。
Not that I know of there might be some。 So really tricky issue often because you don’t know how long it will take to get to。
this sort of stationary distribution。 There’s a really cool paper that just came out like a month ago at NURBS that talks about。
how when we’re thinking about policy evaluation, which we’ll talk more about later today, instead。
of thinking about sort of per step ratios or whether you’ll be taking a certain action。
and a certain policy or not, you can think about these stationary distributions and the。
difference between them and different policies。 Problems you often don’t know how long and whether your data has got to that stationary。
distribution。 So it would also be really nice if there were easy tests to tell if this was true。
That’s also really hard to know。 Yeah。 Sorry。 I’m actually the very negative, I have an example。
Yes。 Yeah。 Yeah。 Why it was compared to the key groups。 Yes。 So the question is about right。
So I sort of gave a long return use as you know, you gave a long prelude about saying like。
that things might not converge, but everything looked fine there。 We got to go into that more。 Yes。
And we’re going to talk about the fact that actually in the on policy setting where we’re。
just doing policy evaluation, everything’s going to be fine。
It’s only when we get into the control case where we’re going to be using data from one。
policy to estimate the value of another。 We’re in this example and many others things start to go right。
So we’ll use this as a running example, but right now there’s no reason for you to believe。
this is pathological。 Okay。 So this is the stationary distribution and then the convergence guarantees are related。
to that。 Okay。 So what we’re going to do is define the mean squared error of our linear value function。
approximator with respect to the stationary distribution。 Why is this reasonable? Well。
because you probably care more about your function approximated in error in states。
that you visit a lot。 If there’s a state that’s really, really rare。
probably it’s okay to have bigger error there。 You want your overall mean squared error to be defined on that stationary distribution。
So this is the mean squared sort of value prediction error and it compares what we predict。
versus the true value weighed by this distribution of states。
And what we’re assuming for right now is that the approximation we’re using is a linear。
value function approximator。 Let me just note for historical reasons that John does it sit-class and Ben Van Roy。
John, is at MIT。 I had the pleasure of him teaching me probability, which was great。
And then Ben Van Roy is here and was one of, I think, John’s PhD students or post-jocks。 Anyway。
they, in about 1997, people were getting really interested in whether or not when you。
combine function approximation with reinforcement learning, what happened and whether things。
were good or bad and they’re responsible for this nice analysis。
So let’s assume we have a linear value function approximator。
What you can prove is that if you do Monte Carlo policy evaluation for linear value function。
approximators, you’re going to converge to the weight which have the minimum means squared。
error possible。 It’s kind of best you could hope for。
So this is saying in the limit is you have lots and lots of data and you run this many, many。
many times, then you can just converge to the best weights possible。
Now this error might not be zero because it might be that your value function is not。
approximatable with your linear set of weights。 But it’s going to do the best job it can。
So I’m just going to find the best。 It’s basically just doing the best linear regression that you can do on your data。
So that’s good。 It’s sort of a nice sanity check。 It’s going to converge to the best thing that you could hope to do。
So maybe we’ve been asking about, OK, well, I’m going to be the sort of incremental method。
And maybe in some cases that’s reasonable。 Maybe you’re running like a customer recommendation system and you’re getting data over time and。
you’re updating this estimator。 But in some cases you might have access to just a whole bunch of data from this policy。
and couldn’t you just do that kind of more directly? And the answer is yes。
So this is often called batch Monte Carlo value function approximator。
And the idea is that you have a whole bunch of episodes from a policy。
And the nice thing is now you can just kind of analytically solve for the best approximator。
So again, our GIs are going to be our unbiased sample of the true expected return。
And what you can do is now N is just our set of data。 This is really a linear regression problem。
We’re going to use our unbiased samples, estimates of the true value function。
We’re just going to find the weights that minimize this mean squared error。 You take the derivative。
you set it to zero。 It’s linear regression。 You can solve for this analytically。
So just like how we talked about, you could do policy evaluation analytically in some cases。
You can also do it analytically in this case for the linear value function approximator。
And note again, this is Monte Carlo。 We’re not making any Markov assumptions。
We’re just using the full return。 This is also fine in non-Markov environments。 [INAUDIBLE]。
[INAUDIBLE], OK, so when we want to do this versus the other iterative one。
this generally has higher, computational cost。 Xs can be a very large matrix。
It may not be possible even write down。 Xx is all of your data in the future representation form。
And it requires taking a matrix inverse。 So that may not be feasible if you’ve got huge feature vectors and millions of billions。
of customers。 Facebook can’t do this directly。 And also, if you’re doing this。
you could do this incrementally, but you’re always refitting, with all of your data。
That also could be very expensive。 So most of it’s about memory and computation。
If you have a really small case, it’s probably a good thing to do。
And it also depends whether you already have all your data or not。 Yeah。
He goes through sub-batch as well, right? And that could help with convergence and not having your gradient estimation structure。
quite as much。 So of course, there’s an in-between。
So you could do-- if you have access to quite a bit of data, you could either do it completely。
incrementally or all batch, or you could do sub-batches。
And there’s some nice work by my colleagues and also us showing that in terms of we get。
into deep learning, there can be a lot of benefits to doing some amount of this analytical。
aspect over a sub-batch of data。 Because you’re sort of-- particularly when you get into TD learning。
you’re propagating, information a lot more quickly than you are if you’re just doing this incremental slow。
update。 Because remember, in TD learning, we’re also only doing one step of backup compared to。
propagating all of our information back like we do with Monte Carlo。 All right。
So now we’re going to get into temporal difference learning。
So remember in temporal difference learning, we’re going to use both bootstrapping and sampling。
Monte Carlo only uses sampling to approximate the expectation。
TD learning also uses bootstrapping because we don’t have to wait till the end of an episode。
We just bootstrap and combine and are estimated the expected discount of some of returns by。
using our current value function。 So in this case, what we used to do is we would bootstrap。
This is the bootstrapping part。 And what we often call our target is the reward plus gamma times the value of the next。
state。 And I remember the reason this is sampling is we’re sampling this to approximate our expectation。
We’re not taking the full probability of S prime given SA and summing over all of S prime。
So before we did this and we represented everything as a table, now we want to not do, that anymore。
So let me just-- before we get into this, let me just remind us the three forms of-- or。
the forms of approximation we’re going to have now。
Now we’re going to have a function approximation, bootstrapping and sampling。
But we’re still on policy。 What do I mean by that?
Right now we’re still just doing policy evaluation, which means we’re getting data from the policy。
that we’re trying to estimate its value。 It turns out things are just way easier in that case when you’re on policy。
And perhaps that this should be somewhat intuitive。
It’s quite similar to the supervised learning case。 Supervised learning。
you’re generally assuming your data is all IID。 Our data is a little bit more complicated than that。
But our data is closer to that in this case because we have a single policy。
It’s not sort of this non-stationary aspect that comes up when we start changing the policy。
So right now we have these three forms of approximation, function approximation, bootstrapping。
sampling, but we’re still on policy and mostly things are still going to be okay in terms of convergence。
So what does that look like? We’re again going to sort of think about doing the equivalent of supervised learning。
We’d like to just have our states and the oracle tell us what the value is and fit our, function。
Instead of having the oracle, we’re going to use our TD estimates。
So we’re going to use our word plus gamma times our approximate value of the next state。
And that’s going to form our estimate of what the true value is。
And then we’re going to find the weights to minimize the mean squared error in that setting。
So if we do that, what we can see is that if we’re doing the sort of the linear case。
we write this out as just this is the TD target。 Just as a quick side note。
I’m going to use the word TD zero a lot。 We haven’t talked about it in this class。
but there’s actually a whole bunch of different, slight variance of TD which are often called TV gamma。
And so if you’re reading the book, that might be a little bit confusing。
So I just want to be clear that we’re doing the TD zero variant, which is probably the。
most popular。 There’s a lot of other extensions for simplicity。
We’re just going to focus on TD zero for now。 So this is the TD target。
This is our current estimate。 And then we take the derivative。 In this case。
that means that we’re going to end up plugging in our linear value function。
approximator for both our current state, the next state, and looking at that difference。
weighed by the feature vector。 So it should look almost identical to the Monte Carlo update except for the fact that。
now we’re bootstrapping。 So instead of this being G versus being the G return that we saw before for a particular。
episode。 Now we’re bootstrapping and we’re getting the immediate award plus an estimate of the discounted。
sum of rewards which we’re using in our value function approximator to estimate。
So this is what the TD learning linear value function approximation for policy evaluation。
algorithm looks like。 Again, we’re going to initialize our weight vector。
We’re going to sample a tuple and then we’re going to update our weights。
So we get to now update our weights after every single tuple, just like what we saw for。
TD learning。 And what we can see here is that we’re just plugging in our particular estimator minus。
our old estimator times x。 So let’s see what this looks like on the Barrett example。 So again。
we have the same state feature representation as before。 State one is two zero, zero, zero, zero。
one。 We still have zero awards for everywhere that set our alpha equal to point five。
Now we’re in the case where we can say that there is no terminal state because TD learning。
can handle just continuous online learning。 So we’re just going to assume that S seven always stays in S seven under action A one。
So A one is the solid line and A two is the dashed。
And we’re going to initialize our weights to one one one one。 And then let’s look at this tuple。
So just like the first tuple we saw before, imagine we’re in state one。
We took action A one with our award of zero and went to state S seven。
So why don’t we take a minute and you calculate what the new weights would be after we do。
that update and maybe compare back to the Monte Carlo case in terms of how much they, have changed。
Feel free to talk to a neighbor。 I think this is a little bit bigger so it’s easy to remember what S seven is。
This is what we were talking about。 Okay。 All right。 Have they moved a lot a little?
How much of the waves changed compared to what we saw with Monte Carlo?
And some people indicate smaller。 Okay。 So the initial value of the states, this is going to be。
so for x of s1 times w, it’s, still going to be 3。 For x, s prime, s prime is 7。
If we look up what that is, this is also going to be 3。
But now what we’re going to have is we’re going to have delta, w is equal to alpha times, 0 plus 0。
9 times 3 minus 3。 And so that’s going to be equal to alpha times minus 0。3。
So remember before it was actually minus 3。 So it was a much bigger update。
And so then when we add that into our new weights, we’re going to move our weights, but。
we’re going to move them much smaller than we saw before。 And it shouldn’t be too surprising。
it’s sort of consistent with what we saw for Monte Carlo, updating and TD learning。
TD learning is only updating these sort of smaller, local changes, like one state action。
or next time at state。 The Monte Carlo is saying this is an episode full episodic return。
It’s not bootstrapping。 So it’s saying no really the return from starting in state s1 is 0。
So we’re going to move it a lot more here。 It’s saying OK。
I’m going to pretend that the return from state s1 is 2。7, which is close, to 3。 It’s not 0。
So when we move our weights over here, the difference is going to be much smaller than。
what we saw from Monte Carlo, which is similar to what we saw without function approximator。
All right。 Whatever our theoretical properties in this case, pretty good。 So these are also。
if you look at TD0, you’re going to converge to weights, which aren’t。
necessarily quite as good as Monte Carlo, but they’re within a constant factor。
So they’re going to be 1 over 1 minus gamma of the minimum possible。
So they’re not quite as good as Monte Carlo, but they’re pretty good。
And depending on your discount factor and the function approximator possible, this varies。
in terms of benefits。 So just to check our understanding for a second。
I’ve put up both of these results。 So one says the Monte Carlo policy evaluator converges to the minimum means greater to。
1 possible under your linear value function approximator。
And TD0 converges to within 1 over 1 minus gamma of this minimum error。 So again。
what is this minimum error that says if you could pick any linear value function, approximator。
how good could that be at representing your true value of your policy?
So let’s take just another minute。 And this is a good one to talk to a neighbor about。
If the value function approximator is the tabular representation, what is the MSPE for both Monte。
Carlo and TD? So we guaranteed to converge to the optimal solution。
optimal value for the true value for, V of pi or not。 If it’s not clear what the question is。
feel free to ask。 So when you say it’s a tabular representation。
do you mean that you are reducing the representation, of the capacity of the system?
Question is if I say it’s a tabular representation, what do I mean by that?
I mean that there is one feature for each state。 It’s like a one-hot encoding。
So it’s like the same representations we saw for the first few lectures where, like, for。
each state, you have a table lookup for that value of that state。 Yeah。 [inaudible], So TD is there。
Everything we’re seeing in a question is about TD versus the TD is there。
Everything we’re talking about in class right now is TD zero。
I’m using that because there are multiple versions of TD and if you look at the book。
they’ll have TD lambda sometimes too。 So I’m just making sure it’s clear。
So if you read other resources, you’ll know which version of TD to map to。 All right。 Well。
first question。 If we’re using a tabular representation。
can we exactly represent the value of a policy? If we’re using the, if we。
for every single state in the world, you can have a different, table representation。
Can we exactly represent the value of the policy? Yes。 Yeah, we can。
So if you have one feature for every single state in the world, it’s not going to be practical。
We can’t actually do this, but you can exactly represent the value of a policy。
How could you do this? You could simply run the policy for every single state。
Do Monte Carlo returns an average and that would give you the true value of the state。
So you could do it。 You could represent the expected discounted sum of returns by representing that in every。
single table。 So that means that this error is equal to zero because your functional capacity is sufficient。
to represent the value。 So that what we’re saying is in expectation, right。
the difference between what your function, is, what it actually gets to zero。
but in each data set it may be different。 So there is, in expectation at zero, but in any episode。
it’s different。 In this case, if you have a tabular representation and this is in the limit。
so with infinite, amounts of data, et cetera, then this will be。
this will be zero for every single state。 So this equals zero for every state。
You will converge to the right value for every single state if you’re using a tabular representation。
And that’s because if you think of just having like literally infinite amount of data and。
you run your policy, just infinite amount of times, then for every state you have an infinite。
number of trajectories starting from that state and you can write down that value separately。
in the table。 So it’ll be zero。 So what that means is that the mean squared value error for the Monte Carlo estimator is。
zero if you’re using a tabular representation and because it’s zero, that is exactly the。
same as the mean squared value estimator for TD, except for this is just equal to MSBE。
of the Monte Carlo times one over one minus gamma。 So that means that this is also zero。
So if it’s a tabular representation, just to sort of connect back to that, none of these。
but there would have any error。 Yeah, question in a second。 And neighbors。 Yeah。
I’m wondering where the one over one of those gamma points can come from。 Yeah, the question is。
you know, where does that one over one minus gamma constant come, from? In the interest of time。
I’m not going to go through it too much。 I encourage you to read this as a cyclos paper。
Intuitively, there is error that’s a propagating here because of the fact that we’re bootstrapping。
And so if you have a function at what this, what this result is sort of trying to highlight。
is that if your function approximator actually has no error, then there’s going to be no difference。
between Monte Carlo and TD because for both of them, the mean squared value error inside。
of that sum, the minimum over w is going to be zero。
So it doesn’t matter whether you’re using TD or Monte Carlo。 But if that’s not true。
like if you can’t actually exactly represent the value function。
then you’re going to get error and that error is going to like basically you can think of。
one over one minus gamma is approximately a horizon H。 And basically that’s getting。
multiplied because you’re adding up these errors。 And the reason those get added up is because you’re bootstrapping。
So you’re propagating that error back。 Where’s Monte Carlo doesn’t suffer that? Yeah。 In general。
the mean squared error is taken over distribution of the states。 Under a specific policy。
But the only specific one we’ve seen is a stationary distribution。 Do you ever use another one?
Great question。 And it is okay, right now we’re seeing this under the stationary distribution of the states。
that you’re going to reach under the policy that you care about evaluating for that。
I think that’s the right choice because that really is the state you’re going to get to。
under this policy。 When you start to think about control, you might want others。
Like if you’re going to change your policy。 All right。 So let’s, I guess just briefly more on this。
Are they faster? Is one of them better to my knowledge? That’s not really understood。
If you come across any literature on that, I’d love to hear it。 The only TD often is better。
Just empirically often the bootstrapping often helps you a lot。 All right。
Let’s move on briefly to control。 It’s going to be pretty similar。
So instead of representing the value function, we’re going to represent the state action value。
function, which is what we saw before when we wanted to often move from policy evaluation。
to control。 And now what we’re going to do is we’re going to interleaves with policy evaluation with。
a value function approximator with performing like an e-greety policy improvement。
This is where things can start to get unstable。 What are we doing in this case?
We generally involving function approximation, bootstrapping。 We’re also doing sampling。
But really the really big issue seems to be the off policy learning。
But when we think about before we had this nice stationary distribution or we’re converging。
to a stationary distribution over states, we’re not going to be doing that anymore because。
we’re going to be changing our control policy over time。
And so that’s changing the distributions of states that we encounter。
And set in a bar to often call it the deadly triad。
Once you start combining function approximation and bootstrapping and off policy learning。
things start to get a little bit, they can fail to converge or converge to something good。
All right。 But before we get into that, let’s think about it procedurally。
So now we’re going to have Q functions that are parameterized by a W and we can again do。
stochastic gradient descent。 This is going to look almost identical to what we had before。
And again, this stochastic gradient descent can sample the gradient, which means for a。
particular state action pair, then we’re going to do these updates。
So here what we’re going to do is we’re going to represent our Q function by a set of linear。
state action weights。 So that means we’re going to have features that sort of both encode the state and the。
action。 So like what I saw when I was turning left as my robot, for example, so it’s going to。
be a combination of these two。 And then once we have that。
then we’re going to just have a weight vector on top of that, for the Q。
So we’re not having separate weight vectors for each action。 Instead。
we’re having features that try to encompass both the state and action themselves。
And then we can do our stochastic gradient descent on top of that。
So how does this work for like Monte Carlo? It’s going to look almost identical to before。
We’re just going to again use our return。 Now we’re going to be defining returns from a particular state action。
For doing first visit the first time we reached the state action in that episode, we look。
at the return, the sum of rewards till the end of the episode, and we use that as our, target。
That is our estimate of the oracle, the true Q function, and we update towards that。 In Sarsa。
we’re going to use a TD target。 So we’re going to look at the immediate reward of our tuple plus gamma times Q of the next。
state that we encountered and the action we took。 And so then we’re again going to just plug that in。
And then for Q learning, it’s going to look almost identical to Q learning except for again。
we’re going to plug in function approximators everywhere。 So we’re going to plug in this, remember。
is going to be a function of our X, which is, going to be a function of S prime and A prime times our W。
whereas here this is going to, be a function of the state and action。
Everything’s linear and we’re just doing different forms of bootstrapping and comparing。
whether or not we take a max or not。 Alright, so I went through that a little bit fast。
but it’s basically exactly analogous, to the first part。
which we sort of step through more carefully。 Except for everything’s with Q functions now。
Why might this get so weird or tricky? So TD with value function approximation is not really following a gradient。
I don’t have time to go into a ton of details on that today, but there’s some nice explanations。
on this in chapter 11。 So Sartan and Bartow, chapter 11。 That’s a great resource。
And we also have lecture notes available online。 And so, infirmally。
we’re sort of doing this interleaving of doing this like approximate。
sample Bellman backup combined with what’s often known as a projection step because we’re。
trying to sort of project our value function back into the space of representable functions。
And intuitively for why this might start to be a problem is that the Bellman operator。
we showed is a contraction。 Like when we’re doing dynamic programming。
we showed that if you do Bellman, Bellman, backups, you’re guaranteed to converge to a fixed point。
When you do the value function approximator, it can be an expansion。 What does an expansion mean?
Well what a contraction, just as a reminder, what a contraction set is, let’s say for an。
operator that’s a contraction。 If you apply this operator。
and this is an operator like the Bellman equation, Bellman, backup。
if you apply it to two different value functions, the distance between this。
it could be like a max norm or something like that is less than or equal to the previous, distance。
which means as you apply this operator, the distance between your old value function。
and your value function keeps getting smaller and smaller and smaller and eventually get。
to a fixed point。 The problem is now we’re not doing that anymore。
It’s more like we’re doing like O V and then we do some sort of projection operator。
I’m just going to call it kind of a weird P。 So this is the projection operator。
It means when you compute your new value function, it may no longer lie in your value function。
approximator space。 You’re going to have to refit it back into that space。 When you do that。
that operator itself can be an expansion。 For those of you that are interested in some of the early sort of discussions of this。
Jeff Gordon has a really nice paper on averages from 1995 where they talk about how linear。
value function approximators can be an expansion。 So, the Bellman backup is fine。
It’s a contraction, but when you do this approximation。
you might expand the distance and that’s one, of the problems。 Okay。
so if we go back to our bare example and think about this a little bit more in terms。
of the control case。 So let’s imagine that we have a setting where you have two different policies。
And the first policy and this is the policy that you want to evaluate, you always take。
the solid line。 So you always take A1 and in your behavior data。
this is the policy you’re using to gather, data。 You take A2 with six sevenths of the time and you take A1 one-seventh of the time。
gamma, is 0。99。 And what you do is you generate a whole bunch of data。
So you generate data under your behavior policy。 So there’s some really cool work on how you deal with sort of correcting for the data that。
you’re getting versus the data you want to evaluate。 Let’s imagine we don’t go into any of that。
which I think is super cool。 And instead we’re just going to do something super simple。
which is we’re going to throw, out all the data that doesn’t match。
So imagine you just throw away data if A is not equal to pi of S。 So you generated all。
these data points。 So what does it, what do I mean by data points here? We had S, A, R, S prime。
So you take all these tuples。 If it turns out that the action that was taken there is not the same as the policy you。
want to evaluate, that you’re only ever taking A1, just throw out that tuple。 You don’t update。
So now all of your remaining data is consistent with your policy。
So let’s imagine then you try to do TD learning with that data。 The problem is you can diverge。
And what do I mean by that? It means that your weights can blow up。
Super interesting why this happens。 The main intuition for it is that your distribution data is not the same as the data that you’d。
get under your desired target policy。 In particular。
if you were actually to run the policy you care about pi, what would happen?
Let’s say you start off in state S1。 You take A1, that determinates, so it gets you to state S7。
They’re going to stay in S7 for a really long time because it’s deterministic。 So you get like S1。
S7, S7。 Say when you did this, maybe it wasn’t episode of case and you have multiple episodes。
You’d still have cases where you’d like have very little bit of amount of data about S。
these S’s and lots of data about S7。 But in the data that you get from your behavior policy because a bunch of the time it takes。
A2, it’ll keep teleporting you back to one of S1 through S6。
Which means the distribution of your data, the data you have looks very different。
The distribution of states you visit looks very different than the data that you get。
and the states you visit under pi。 And that is the problem。 If you don’t account for this mismatch。
then the values can diverge。 Even though they’re all sort of compatible。
all in the sense that you’re only ever using, a state action pair if you took the action under your desired policy。
And this sort of issue can also come up when you’re using Q-learning and you’re doing generally。
like updating this policy over time。 So in terms of this。
just to briefly summarize before we finish, in the tabular case everything, converges。
it’s beautiful。 In the linear case, try me by this, I mean that can shatter。
You basically converge but you might, there might be some oscillation。
But Q-learning like we were doing this off policy aspect can diverge。
And once we get into nonlinear value function approximation, like mostly all bets are off。
Now this is a little bit of an oversimplification。
There has been a huge amount of work and huge amount of interest in this because everyone。
wants to do function approximation with RL so we can tackle real problems。
And so over the last like one or two decades, there’s been a huge amount of work on this。
And there are some algorithms now that do have convergence guarantees。 And there’s some super cool。
really recent work where they’re looking at Batterrrel which。
can converge with nonlinear approximators。 So there’s definitely a lot of work on this that we’re not going to get to。
I just want to highlight that it’s a really important issue not just whether it converges。
but what it converges to。 Like you might converge to a point which is a really bad approximator。
So it’s stable, it doesn’t, your weights aren’t blowing up but it’s just a really bad, approximator。
And some of the critical choices here are your objective function and your feature representation。
So just before we close, I think this is a really nice figure from Seton and Bartow。
What they’re showing here is you can think of it as like you have this plane which is。
where you can represent all of your linear value function approximators。
And what happens when you do a Bellman update or like you do a TD backup is that you’re going。
to now sort of have a value function that might not be representable in your plane。
And you can project it back。 And these different, you can quantify different forms of error。
Basically this allows you to find different objective functions that you’re trying to minimize。
in order to find the best approximator。 And we’ve seen one today which is sort of this minimum mean squared error approximator。
Essentially over the like these Bellman errors but that’s not the only choice and it’s not。
necessarily even the best choice。 Because it might be that the one that has the smallest error there is not the same one。
that has the best performance in your real problem。
So that’s a little bit fast but it’s super interesting that’s covered in Seton and Bartow。
and 11 if you want to go into more detail。 Just really quick。
what are the things you should understand? You should be able to implement these ones on linear value function approximator both。
for policy evaluation and control。 You should understand whether or not things converge in the policy evaluation case and。
when the solution has zero error and non-zero error。
And you should just understand qualitatively what are the issues that can come up so that。
some of these solutions may not always converge。 And it’s this combination of function approximation bootstrapping and all policy learning。
Alright so that’s enough to sort of get started with the homework too that we’re going to be。
releasing this today and then next week we’re going to start to talk about defining。 Thanks。
[BLANK_AUDIO]。
605



被折叠的 条评论
为什么被折叠?



