当我运行以下代码时:
\begin{align*}
\text{Here, } i = 2, 5, \text{ and } 6, \text{ because observations 2, 5, and 6 } & \text{are the closest (by Euclidian distance)} \\
P(Y = Red \mid X = (0, 0, 0)) &= \frac{1}{3} \sum_{i \in N_0} (i = Red) \\
&= \frac{1}{3}(1 + 0 + 1) \\
&= \frac{2}{3} \\
\text{and} \\
P(Y = Green \mid X = (0, 0, 0)) &= \frac{1}(3}\sum_{i \in N_0} (j = Green) \\
&= \frac{1}{3}(0 + 1 + 0) \\
&= \frac{1}{3}
\end{align*}
我收到以下错误:
! Argument of \align* has an extra }.
<inserted text>
\par
l.248 ... Green \mid X = (0, 0, 0)) &= \frac{1}(3}
\sum_{i \in N_0} (j = Gree...
据我所知,这个错误并不总是意味着你确实有一个额外的}。
答案1
在这种情况下,一个好方法是注释和取消注释各行或各行的部分内容,然后反复重新编译以查看错误何时消失并再次出现。
这样做帮助我找到
P(Y = Green \mid X = (0, 0, 0)) &= \frac{1}(3}\sum_{i \in N_0} (j = Green) \\
具体来说
\frac{1}(3}
那是一个(
应该的{
。