-
-
Notifications
You must be signed in to change notification settings - Fork 26.4k
[MRG] Examples use int / int without __future__.division #9426
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
|
Currently the flake8 test is failing. Can you add the error F404 to the exceptions for examples in |
| input features would be to use univariate feature selection followed by a | ||
| traditional (l2-penalised) logistic regression model. | ||
| """ | ||
| from __future__ import division |
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.
this is one way or you just can be explicit with div so 1 / n_classes -> 1. / n_classes
link this no need to hack the pep8 rules :)
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.
Yeah, true, this seems to be another way to approach this. @jnothman your opinions of using this instead?
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 like the __future__ but there are advantages in the other, like not confusing python 2 users who are unaware of the __future__, making copy-paste work. If Alex suggested it, I wouldn't seek a second opinion, either ;)
|
@amueller tested locally with the exception code and was failing |
| n_pts = 36 | ||
| x, y = np.ogrid[0:l, 0:l] | ||
| mask_outer = (x - l / 2) ** 2 + (y - l / 2) ** 2 < (l / 2) ** 2 | ||
| mask_outer = (x - (l * 1.0) / 2) ** 2 + (y - (l * 1.0) / 2) ** 2 \ |
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 use enclosing parenthesis instead of \ to break long lines.
|
lgtm :) |
|
Ugh pep8 complaining about W503 "line break before binary operator". Can we ignore that? |
|
@amueller I updated it :) |
| n_pts = 36 | ||
| x, y = np.ogrid[0:l, 0:l] | ||
| mask_outer = (x - l / 2) ** 2 + (y - l / 2) ** 2 < (l / 2) ** 2 | ||
| mask_outer = ((x - (l * 1.0) / 2) ** 2 + (y - (l * 1.0) / 2) ** 2 < |
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.
why not just l / 2.0 instead of (l * 1.0) / 2
| n_pts = 36 | ||
| x, y = np.ogrid[0:l, 0:l] | ||
| mask_outer = (x - l / 2) ** 2 + (y - l / 2) ** 2 < (l / 2) ** 2 | ||
| mask_outer = (x - l / 2.0) ** 2 + (y - l / 2.0) ** 2 < (l / 2.0) ** 2 |
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.
even better would be:
mask_outer = (x - l. / 2.) ** 2 + (y - l. / 2.) ** 2 < (l. / 2.) ** 2
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 don't think appending . after variable works. Anyways, I have removed the extra zeroes, as suggested.
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.
Thanks for bearing with our nitpicks
Reference Issue
Fixes #9421
What does this implement/fix? Explain your changes.
Include future.division to support int / int
Any other comments?
No.