New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update naive-bayes.md #1656
Update naive-bayes.md #1656
Conversation
Job d2l-en/PR-1656/1 is complete. |
Hey @particle1331 , great catch! I like the way you describe the formula, while it seems to be not a legitimate one... I reconstruct the math and text in the following way: If it makes sense to you, please update this PR as is. (Attached the latex below.)
|
Job d2l-en/PR-1656/2 is complete. |
@goldmermaid This looks awesome! Will do, thanks. EDIT: I looked more closely, shouldn't it be what is shown here: Here I changed
to
along with introducing |
Job d2l-en/PR-1656/3 is complete. |
LGMT! Thanks for your contribution @particle1331 ! |
@goldmermaid Hi. I'm sorry I wasn't able to push the changes outlined in the comment last night -- I wanted to know first if it works for you. Please check the recent changes if you have time. Thanks! EDIT: One problem that I can't solve is the :eqlabel: |
Job d2l-en/PR-1656/4 is complete. |
Job d2l-en/PR-1656/5 is complete. |
Job d2l-en/PR-1656/6 is complete. |
Job d2l-en/PR-1656/7 is complete. |
\hat{y} | ||
&= \mathrm{argmax}_y \ p(y)\prod_{i=1}^d p(x_t = t_i \mid y)\\ | ||
&= \mathrm{argmax}_y \ P_y[y]\prod_{i=1}^d \ P_{xy}[i, y]^{t_i}\, \left(1 - P_{xy}[i, y]\right)^{1-t_i} | ||
\end{aligned}$$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please seperate the "$$" to a new line. Or the ":eqlabel:eq_naive_bayes_estimation
" won't render properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.e.,
$$
\begin{aligned}
...
\end{aligned}
$$
:eqlabel:`eq_naive_bayes_estimation`
Job d2l-en/PR-1656/9 is complete. |
Job d2l-en/PR-1656/10 is complete. |
@goldmermaid does this PR look good to you now? |
$$ | ||
\begin{aligned} | ||
\hat{y} | ||
&= \mathrm{argmax}_y \ \prod_{i=1}^d P_y[y] \times P_{xy}[i, y]\\ | ||
&= \mathrm{argmax}_y \ \prod_{i=1}^d P_y[y]\ P_{xy}[i, y]^{t_i}\, \left(1 - P_{xy}[i, y]\right)^{1-t_i}, | ||
\end{aligned} | ||
$$ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @particle1331 , apology for a bit delay. Here is the reason why this "eqlabel" is not render well:
"$$\begin{aligned} ... \end{aligned}$$" needs to be on one single line.
Please check (search \begin{aligned}
) in this example: https://github.com/d2l-ai/d2l-en/blob/master/chapter_linear-networks/linear-regression.md.
Let me know if you are still having trouble solving it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Sorry for the delay as well. Thank you for pointing me towards this solution.
It worked. :=)
http://preview.d2l.ai/d2l-en/PR-1656/chapter_appendix-mathematics-for-deep-learning/naive-bayes.html
Job d2l-en/PR-1656/11 is complete. |
Job d2l-en/PR-1656/12 is complete. |
Job d2l-en/PR-1656/13 is complete. |
LGTM! Fantastic work @particle1331 ! |
Description of changes:
There's a mistake in the formula for calculating naive bayes estimates.
P[x_i, y] is not defined. Only P[i, y] is defined which is the conditional probability p(x_i = 1 | y).
By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.