-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-21306][ML] For branch 2.1, OneVsRest should support setWeightCol #18763
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-21306][ML] For branch 2.1, OneVsRest should support setWeightCol #18763
Conversation
## What changes were proposed in this pull request? add `setWeightCol` method for OneVsRest. `weightCol` is ignored if classifier doesn't inherit HasWeightCol trait. ## How was this patch tested? + [x] add an unit test. Author: Yan Facai (颜发才) <[email protected]> Closes #18554 from facaiy/BUG/oneVsRest_missing_weightCol. (cherry picked from commit a5a3189) Signed-off-by: Yanbo Liang <[email protected]>
## What changes were proposed in this pull request? add `setWeightCol` method for OneVsRest. `weightCol` is ignored if classifier doesn't inherit HasWeightCol trait. ## How was this patch tested? + [x] add an unit test. Author: Yan Facai (颜发才) <[email protected]> Closes apache#18554 from facaiy/BUG/oneVsRest_missing_weightCol. (cherry picked from commit a5a3189) Signed-off-by: Yanbo Liang <[email protected]>
ddb83da to
571739d
Compare
|
|
||
| test("SPARK-21306: OneVsRest should support setWeightCol") { | ||
| val dataset2 = dataset.withColumn("weight", lit(1)) | ||
| val dataset2 = dataset.withColumn("weight", lit(1.0)) |
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.
@yanboliang @srowen My mistake. It will be better to use double value 1.0 in master / branch-2.2 / branch-2.3 in the same way.
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.
@facaiy It doesn't matter, since weightCol supports any numeric type and will cast it to double type under the hood.
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.
OK. Could you test and merge the PR into branch 2.1?
|
Jenkins, test this please. |
|
@srowen Could you help to trigger this job? Thanks. |
|
Test build #3866 has finished for PR 18763 at commit
|
|
Jenkins, test this please. |
python/pyspark/ml/classification.py
Outdated
| weightCol = self.getWeightCol() | ||
| else: | ||
| warnings.warn("weightCol is ignored, " | ||
| "as it is not supported by {} now.".format(classifier)) |
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.
To pass Python2.6 test, we need to change this line to:
"as it is not supported by {0} now.".format(classifier))
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.
Modified as suggested, thanks very much!
|
ok to test |
|
Jenkins, test this please. |
|
ok to test |
|
Test build #80345 has finished for PR 18763 at commit
|
The PR is related to #18554, and is modified for branch 2.1. ## What changes were proposed in this pull request? add `setWeightCol` method for OneVsRest. `weightCol` is ignored if classifier doesn't inherit HasWeightCol trait. ## How was this patch tested? + [x] add an unit test. Author: Yan Facai (颜发才) <[email protected]> Closes #18763 from facaiy/BUG/branch-2.1_OneVsRest_support_setWeightCol.
|
Merged into branch-2.1. Thanks @facaiy @gatorsmile |
|
It seems github can't close this PR automatically. @facaiy Please feel free to close it manually. Thanks. |
|
Thanks, all. |
The PR is related to apache#18554, and is modified for branch 2.1. add `setWeightCol` method for OneVsRest. `weightCol` is ignored if classifier doesn't inherit HasWeightCol trait. + [x] add an unit test. Author: Yan Facai (颜发才) <[email protected]> Closes apache#18763 from facaiy/BUG/branch-2.1_OneVsRest_support_setWeightCol.
The PR is related to #18554, and is modified for branch 2.1.
What changes were proposed in this pull request?
add
setWeightColmethod for OneVsRest.weightColis ignored if classifier doesn't inherit HasWeightCol trait.How was this patch tested?