-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-20862][MLLIB][PYTHON] Avoid passing float to ndarray.reshape in LogisticRegressionModel #18081
Conversation
Test build #77275 has finished for PR 18081 at commit
|
LGTM Do we have similar cases in MLlib? |
To test it in jenkins might need a specified numpy version, but the code change looks ok. |
Dumb question but this still works in Python 2.6+ right? |
I think so. |
Nit: usually we won't specially tag it is a BugFix in the title. |
@srowen floor divide has been in python since 2.2, https://www.python.org/download/releases/2.2/. |
@viirya I was running python tests for pyspark-ml and pyspark-mllib and this was the only place where the python3/numpy interaction caused a test failure. There might be other places where floor int division might be preferable to float division, but if they exist they're not causing any of the tests to fail. |
@MrBago Yeah, after a quick scan, seems other |
…n LogisticRegressionModel ## What changes were proposed in this pull request? Fixed TypeError with python3 and numpy 1.12.1. Numpy's `reshape` no longer takes floats as arguments as of 1.12. Also, python3 uses float division for `/`, we should be using `//` to ensure that `_dataWithBiasSize` doesn't get set to a float. ## How was this patch tested? Existing tests run using python3 and numpy 1.12. Author: Bago Amirbekian <[email protected]> Closes #18081 from MrBago/BF-py3floatbug. (cherry picked from commit bc66a77) Signed-off-by: Yanbo Liang <[email protected]>
LGTM, merged into master/branch-2.2/branch-2.1/branch-2.0. Thanks for all. |
…n LogisticRegressionModel ## What changes were proposed in this pull request? Fixed TypeError with python3 and numpy 1.12.1. Numpy's `reshape` no longer takes floats as arguments as of 1.12. Also, python3 uses float division for `/`, we should be using `//` to ensure that `_dataWithBiasSize` doesn't get set to a float. ## How was this patch tested? Existing tests run using python3 and numpy 1.12. Author: Bago Amirbekian <[email protected]> Closes #18081 from MrBago/BF-py3floatbug. (cherry picked from commit bc66a77) Signed-off-by: Yanbo Liang <[email protected]>
…n LogisticRegressionModel ## What changes were proposed in this pull request? Fixed TypeError with python3 and numpy 1.12.1. Numpy's `reshape` no longer takes floats as arguments as of 1.12. Also, python3 uses float division for `/`, we should be using `//` to ensure that `_dataWithBiasSize` doesn't get set to a float. ## How was this patch tested? Existing tests run using python3 and numpy 1.12. Author: Bago Amirbekian <[email protected]> Closes #18081 from MrBago/BF-py3floatbug. (cherry picked from commit bc66a77) Signed-off-by: Yanbo Liang <[email protected]>
…n LogisticRegressionModel ## What changes were proposed in this pull request? Fixed TypeError with python3 and numpy 1.12.1. Numpy's `reshape` no longer takes floats as arguments as of 1.12. Also, python3 uses float division for `/`, we should be using `//` to ensure that `_dataWithBiasSize` doesn't get set to a float. ## How was this patch tested? Existing tests run using python3 and numpy 1.12. Author: Bago Amirbekian <[email protected]> Closes apache#18081 from MrBago/BF-py3floatbug.
…n LogisticRegressionModel Fixed TypeError with python3 and numpy 1.12.1. Numpy's `reshape` no longer takes floats as arguments as of 1.12. Also, python3 uses float division for `/`, we should be using `//` to ensure that `_dataWithBiasSize` doesn't get set to a float. Existing tests run using python3 and numpy 1.12. Author: Bago Amirbekian <[email protected]> Closes apache#18081 from MrBago/BF-py3floatbug. (cherry picked from commit bc66a77) Signed-off-by: Yanbo Liang <[email protected]>
What changes were proposed in this pull request?
Fixed TypeError with python3 and numpy 1.12.1. Numpy's
reshape
no longer takes floats as arguments as of 1.12. Also, python3 uses float division for/
, we should be using//
to ensure that_dataWithBiasSize
doesn't get set to a float.How was this patch tested?
Existing tests run using python3 and numpy 1.12.