Posted on Categories:CS代写, Machine Learning, 机器学习, 计算机代写

# 计算机代写|机器学习代写Machine Learning代考|Learning

avatest™

## avatest™帮您通过考试

avatest™的各个学科专家已帮了学生顺利通过达上千场考试。我们保证您快速准时完成各时长和类型的考试，包括in class、take home、online、proctor。写手整理各样的资源来或按照您学校的资料教您，创造模拟试题，提供所有的问题例子，以保证您在真实考试中取得的通过率是85%以上。如果您有即将到来的每周、季考、期中或期末考试，我们都能帮助您！

•最快12小时交付

•200+ 英语母语导师

•70分以下全额退款

## 计算机代写|机器学习代写Machine Learning代考|Learning

Given a data set $\mathbf{y}{1: N}$, where each data point is assumed to be drawn independently from the model, we learn the model parameters, $\theta$, by minimizing the negative log-likelihood of the data: \begin{aligned} \mathcal{L}(\theta) & =-\ln p\left(\mathbf{y}{1: N} \mid \theta\right) \ & =-\sum_i \ln p\left(\mathbf{y}_i \mid \theta\right) \end{aligned}
Note that this is a constrained optimization, since we require $a_j \geq 0$ and $\sum_j a_j=1$. Furthermore, $\mathbf{K}_j$ must be symmetric, positive-definite matrix to be a covariance matrix. Unfortunately, this optimization cannot be performed in closed-form.

One approach is to use gradient descent to optimization by gradient descent. There are a few issues associated with doing so. First, some care is required to avoid numerical issues, as discussed below. Second, this learning is a constrained optimization, due to constraints on the values of the $a$ ‘s. One solution is to project onto the constraints during optimization: at each gradient descent step (and inside the line search loop), we clamp all negative $a$ values to zero and renormalize the $a$ ‘s so that they sum to one. Another option is to reparameterize the problem to be unconstrained. Specifically, we define new variables $\beta_j$, and define the $a$ ‘s as functions of the $\beta$ s, e.g.,
$$a_j(\beta)=\frac{e^{\beta_j}}{\sum_{j=1}^K e^{\beta_j}}$$

This definition ensures that, for any choice of the $\beta \mathrm{s}$, the as will satisfy the constraints. We substitute this expression into the model definition and then optimize for the $\beta \mathrm{s}$ instead of the as with gradient descent. Similarly, we can enforce the constraints on the covariance matrix by reparameterization; this is normally done using a upper-triangular matrix $\mathbf{U}$ such that $\mathbf{K}=\mathbf{U}^T \mathbf{U}$.

An alternative to gradient descent is the Expectation-Maximization algorithm, or EM. EM is a quite general algorithm for “hidden variable” problems; in this case, the labels $L$ are “hidden” (or “unobserved”). In EM, we define a probabilistic labeling variable $\gamma_{i, j}$. The variable $\gamma_{i, j}$ corresponds to the probability that data point $i$ came from cluster $j: \gamma_{i, j}$ is meant to estimate $P\left(L=j \mid \mathbf{y}_i\right)$. In EM, we optimize both $\theta$ and $\gamma$ together. The algorithm alternates between the “E-step” which updates the $\gamma \mathrm{s}$, and the “M-step” which updates the model parameters $\theta$.

## 计算机代写|机器学习代写Machine Learning代考|Numerical issues

Exponentiating very small negative numbers can often lead to underflow when implemented in floating-point arithmetic, e.g., $e^{-A}$ will give zero for large $A$, and $\ln e^{-A}$ will give an error (or $-\operatorname{Inf}$ ) whereas it should return $-A$. These issues will often cause machine learning algorithms to fail; MoG has several steps which are susceptible. Fortunately, there are some simple tricks that can be used.

Many computations can be performed directly in the log domain. For example, it may be more stable to compute
$$a e^b$$
as
$$e^{\ln a+b}$$
This avoids issues where $b$ is so small that $e^b$ evaluates to zero in floating point, but $a e^b$ is much greater than zero.
When computing an expression of the form:
$$\frac{e^{-\beta_j}}{\sum_j e^{-\beta_j}}$$
large values of $\beta$ could lead to the above expression being zero for all $j$, even though the expression must sum to one. This may arise, for example, when computing the $\gamma$ updates, which have the above form. The solution is to make use of the identity:
$$\frac{e^{-\beta_j}}{\sum_j e^{-\beta_j}}=\frac{e^{-\beta_j+C}}{\sum_j e^{-\beta_j+C}}$$
for any value of $C$. We can choose $C$ to prevent underflow; a suitable choice is $C=\min _j \beta_j$.
Underflow can also occur when evaluating
$$\ln \sum_i e^{-\beta_j}$$
which can be fixed by using the identity
$$\ln \sum_i e^{-\beta_j}=\left(\ln \sum_i e^{-\beta_j+C}\right)-C$$

## 计算机代写|机器学习代写Machine Learning代考|Least-Squares PCA in one-dimensio

$$\arg \min \mathbf{w}, x 1: N, \mathbf{b} \sum_i\left|\mathbf{y} i-\left(\mathbf{w} x_i+\mathbf{b}\right)\right|^2 \text { subject to } \mathbf{w}^T \mathbf{w}=1$$

$$L(\mathbf{w}, x 1: N, \mathbf{b}, \lambda)=\sum_i\left|\mathbf{y}_i-\left(\mathbf{w} x_i+\mathbf{b}\right)\right|^2+\lambda\left(|\mathbf{w}|^2-1\right)$$

$$\frac{d L}{d x_i}=-2 \mathbf{w}^T\left(\mathbf{y}_i-\left(\mathbf{w} x_i+\mathbf{b}\right)\right)=0$$

$$x_i=\mathbf{w}^T\left(\mathbf{y}_i-\mathbf{b}\right)$$

## 计算机代写|机器学习代写Machine Learning代考|Multiple constraints

$$\nabla E+\sum_k \lambda_k \nabla g_k=0$$

$$L(\mathbf{x}, \lambda 1: K)=E(\mathbf{x})+\sum_k \lambda_k g_k(\mathbf{x})$$

• 最优解在约束区域内，因此 $\nabla E=0$ 和 $g(\mathbf{x})>0$. 在这个区域中，约束是“不活跃的”，这意味着 $\lambda$ 可以设 置为零。
• 最优解在边界上 $g(\mathbf{x})=0$. 在这种情况下，梯度 $\nabla E$ 必须指向梯度的相反方向 $g$; 否则，邅循梯度 $E$ 会导 致 $g$ 在改变的同时变得积极 $E$. 因此，我们必须有 $\nabla E=-\lambda \nabla g$ 为了 $\lambda \geq 0$.
请注意，在这两种情况下，我们都有 $\lambda g(\mathbf{x})=0$. 因此，我们可以强制发现这些情况之一具有以下优化问题:
$$\max _{\mathbf{w}, \lambda} E(\mathbf{x})+\lambda g(\mathbf{x}) \text { such that } g(\mathbf{x}) \geq 0 \quad \lambda \geq 0 \quad \lambda g(\mathbf{x})=0$$
这些称为 Karush-Kuhn-Tucker (KKT) 条件，它概括了拉格朗日乘数法。

## MATLAB代写

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