### 统计代写|强化学习作业代写Reinforcement Learning代考|Prediction with Monte Carlo

statistics-lab™ 为您的留学生涯保驾护航 在代写强化学习Reinforcement Learning方面已经树立了自己的口碑, 保证靠谱, 高质且原创的统计Statistics代写服务。我们的专家在代写强化学习Reinforcement Learning代写方面经验极为丰富，各种代写强化学习Reinforcement Learning相关的作业也就用不着说。

• Statistical Inference 统计推断
• Statistical Computing 统计计算
• (Generalized) Linear Models 广义线性模型
• Statistical Machine Learning 统计机器学习
• Longitudinal Data Analysis 纵向数据分析
• Foundations of Data Science 数据科学基础

## 统计代写|强化学习作业代写Reinforcement Learning代考|Prediction with Monte Carlo

When we do not know the model dynamics, what do we do? Think back to a situation when you did not know something about a problem. What did you do in that situation? You experiment, take some steps, and find out how the situation responds. For example, say you want to find out if a die or a coin is biased or not. You toss the coin or throw the die multiple times, observe the outcome, and use that to form your opinion. In other words, you sample. The law of large numbers from statistics tell us that the average of samples is a good substitute for the averages. Further, these averages become better as the number of samples increase. If you look back at the Bellman equations in the previous chapter, you will notice that we had expectation operator $\mathrm{E}[\cdot]$ in those equations; e.g., the value of a state being $v(s)=E\left[G_{t} \mid S_{t}=s\right]$. Further, to calculate $v(s)$, we used dynamic programming requiring the transition dynamics $p(s, r \mid s, a)$. In the absence of the model dynamics knowledge, what do we do? We just sample from the model, observing returns starting from state $S=s$ and until the end of the episode. We then average the returns from all episode runs and use that average as an estimate of $v_{\pi}(s)$ for the policy $\pi$ that the agent is following. This in a nutshell is the approach of Monte Carlo methods: replace expected returns with the average of sample returns.
There are a few points to note. MC methods do not require knowledge of the model. The only thing required is that we should be able to sample from it. We need to know the return of starting from a state until termination, and hence we can use MC methods only on episodic MDPs in which every run finally terminates. It will not work on nonterminating environments. The second point is that for a large MDP we can keep the focus on sampling only that part of the MDP that is relevant and avoid exploring irrelevant parts of the MDP. Such an approach makes MC methods highly scalable for very large problems. A variant of the MC method called Monte Carlo tree search (MCTS) was used by OpenAI in training a Go game-playing agent.

## 统计代写|强化学习作业代写Reinforcement Learning代考|Bias and Variance of MC Predication Methods

Let’s now look at the pros and cons of “first visit” versus “every visit.” Do both of them converge to the true underlying $V(s)$ ? Do they fluctuate a lot while converging? Does one converge faster to true value? Before we answer this question, let’s first review the basic concept of bias-variance trade-off that we see in all statistical model estimations, e.g., in supervised learning.

Bias refers to the property of the model to converge to the true underlying value that we are trying to estimate, in our case $v_{\pi}(s)$. Some estimators are biased, meaning they are not able to converge to the true value due to their inherent lack of flexibility, i.e., being too simple or restricted for a given true model. At the same time, in some other cases, models have bias that goes down to zero as the number of samples grows.

Variance refers to the model estimate being sensitive to the specific sample data being used. This means the estimate value may fluctuate a lot and hence may require a large data set or trials for the estimate average to converge to a stable value.

The models, which are very flexible, have low bias as they are able to fit the model to any configuration of a data set. At the same time, due to flexibility, they can overfit to the data, making the estimates vary a lot as the training data changes. On the other hand, models that are simpler have high bias. Such models, due to the inherent simplicity and restrictions, may not be able to represent the true underlying model. But they will also have low variance as they do not overfit. This is known as bias-variance trade-off and can be presented in a graph as shown in Figure 4-3.

## 统计代写|强化学习作业代写Reinforcement Learning代考|Control with Monte Carlo

Let’s now talk about control in a model-free setup. We need to find the optimal policy in this setup without knowing the model dynamics. As a refresher, let’s look at the generalized policy iteration (GPI) that was introduced in Chapter 3. In GPI, we iterate between two steps. The first step is to find the state values for a given policy, and the second step is to improve the policy using greedy optimization. We will follow the same GPI approach for control under MC. We will have some tweaks, though, to account for the fact that we are in model-free world with no access/knowledge of transition dynamics.
In Chapter 3 , we looked at state values, $v(s)$. However, in the absence of transition dynamics, state values alone will not be sufficient. For the greedy improvement step, we need access to the action values, $q(s, a)$. We need to know the q-values for all possible actions, i.e., all $q(S=s, a)$ for all possible actions $a$ in state $S=s$. Only with that information will we be able to apply a greedy maximization to pick the best action, i.e., $\operatorname{argmax}_{\mathrm{a}} q(\mathrm{~s}, a)$. $^{2}$

We have another complication when compared to DP. The agent follows a policy at the time of generating the samples. However, such a policy may result in many stateaction pairs never being visited, and even more so if the policy is a deterministic one. If the agent does not visit a state-action pair, it does not know all $q(s, a)$ for a given state, and hence it cannot find the maximum q-value yielding an action. One way to solve the issue is to ensure enough exploration by exploring starts, i.e., ensuring that the agent starts an episode from a random state-action pair and over the course of many episodes covers each state-action pair enough times, in fact, infinite in limit.
Figure 4-4 shows the GPI diagram with the change of $v$-values to $q$-values. The evaluation step now is the MC prediction step that was introduced in the previous section. Once the q-values stabilize, greedy maximization can be applied to obtain a new policy. The policy improvement theorem ensures that the new policy will be better or at least as good as the old policy. The previous approach of GPI will be a recurring theme. Based on the setup, the evaluation steps will change, and the improvement step invariably will continue to be greedy maximization.

## 有限元方法代写

tatistics-lab作为专业的留学生服务机构，多年来已为美国、英国、加拿大、澳洲等留学热门地的学生提供专业的学术服务，包括但不限于Essay代写，Assignment代写，Dissertation代写，Report代写，小组作业代写，Proposal代写，Paper代写，Presentation代写，计算机作业代写，论文修改和润色，网课代做，exam代考等等。写作范围涵盖高中，本科，研究生等海外留学全阶段，辐射金融，经济学，会计学，审计学，管理学等全球99%专业科目。写作团队既有专业英语母语作者，也有海外名校硕博留学生，每位写作老师都拥有过硬的语言能力，专业的学科背景和学术写作经验。我们承诺100%原创，100%专业，100%准时，100%满意。

## MATLAB代写

MATLAB 是一种用于技术计算的高性能语言。它将计算、可视化和编程集成在一个易于使用的环境中，其中问题和解决方案以熟悉的数学符号表示。典型用途包括：数学和计算算法开发建模、仿真和原型制作数据分析、探索和可视化科学和工程图形应用程序开发，包括图形用户界面构建MATLAB 是一个交互式系统，其基本数据元素是一个不需要维度的数组。这使您可以解决许多技术计算问题，尤其是那些具有矩阵和向量公式的问题，而只需用 C 或 Fortran 等标量非交互式语言编写程序所需的时间的一小部分。MATLAB 名称代表矩阵实验室。MATLAB 最初的编写目的是提供对由 LINPACK 和 EISPACK 项目开发的矩阵软件的轻松访问，这两个项目共同代表了矩阵计算软件的最新技术。MATLAB 经过多年的发展，得到了许多用户的投入。在大学环境中，它是数学、工程和科学入门和高级课程的标准教学工具。在工业领域，MATLAB 是高效研究、开发和分析的首选工具。MATLAB 具有一系列称为工具箱的特定于应用程序的解决方案。对于大多数 MATLAB 用户来说非常重要，工具箱允许您学习应用专业技术。工具箱是 MATLAB 函数（M 文件）的综合集合，可扩展 MATLAB 环境以解决特定类别的问题。可用工具箱的领域包括信号处理、控制系统、神经网络、模糊逻辑、小波、仿真等。