-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Correcting the Gaussian Formula #2249
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
Conversation
I have added the parenthesis around the 2*sigma^2 term.
None of the doctests needed to change?!? That implies that the results of the calculation did not change. This needs some doctests which fail under the old formulation and pass under the new formulation. |
I tried the doctests provided in the code and the new formulation provides exactly the same results. |
So this PR corrects an algorithm that was already correct? https://docs.python.org/3/reference/expressions.html#operator-precedence |
It turns out when you vary the value of mu, the differences emerge. I have added a doctest which the old formulation would fail. Should i add more? |
Hey @aryan26roy, TravisCI finished with status TravisBuddy Request Identifier: 9c34dd10-d115-11ea-b8d2-e37d5f97d09d |
@aryan26roy Also try varying the sigma #2212 But large sigma values don't show the difference, they should be small. |
Hey @aryan26roy, TravisCI finished with status TravisBuddy Request Identifier: 23655cd0-d191-11ea-bb2f-e1a2ee6530fc |
Hey, i have varied the sigma as well. The old formulation will fail the two new doctests. However, it is encountering a build error. |
Whitespace errors that should be easy to fix. |
Hey @aryan26roy, TravisCI finished with status TravisBuddy Request Identifier: f9dcc340-d1b2-11ea-bb2f-e1a2ee6530fc |
Hey @aryan26roy, TravisCI finished with status TravisBuddy Request Identifier: 07730b80-d1b4-11ea-bb2f-e1a2ee6530fc |
Hey, i have removed the error. |
maths/gaussian.py
Outdated
@@ -21,7 +21,7 @@ def gaussian(x, mu: float = 0.0, sigma: float = 1.0) -> int: | |||
|
|||
>>> gaussian(1,4,3) | |||
0.0806569081730478 | |||
|
|||
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.
whitespace error.
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.
That is an older version. I have updated and removed all the white spaces.
>>> gaussian(1,5,3) | ||
0.05467002489199788 | ||
|
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.
See?
Hey @aryan26roy, TravisCI finished with status TravisBuddy Request Identifier: 5c3cb080-d1d2-11ea-bb2f-e1a2ee6530fc |
* Correcting the Gaussian Formula I have added the parenthesis around the 2*sigma^2 term. * Update gaussian.py * Update gaussian.py * Update gaussian.py * Update gaussian.py * Update gaussian.py * Update gaussian.py Co-authored-by: Christian Clauss <[email protected]>
I have added the parenthesis around the 2*sigma^2 term.
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.