Skip to content

Conversation

@facaiy
Copy link
Contributor

@facaiy facaiy commented Jul 28, 2017

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?

  • add an unit test.

@facaiy facaiy changed the title [SPARK-21306][ML] OneVsRest should support setWeightCol for branch-2.1 [SPARK-21306][ML] For branch-2.1, OneVsRest should support setWeightCol Jul 28, 2017
facaiy referenced this pull request Jul 28, 2017
## 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]>
facaiy added 2 commits July 29, 2017 06:50
## 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]>
@facaiy facaiy force-pushed the BUG/branch-2.1_OneVsRest_support_setWeightCol branch from ddb83da to 571739d Compare July 28, 2017 22:52
@facaiy facaiy changed the title [SPARK-21306][ML] For branch-2.1, OneVsRest should support setWeightCol [SPARK-21306][ML] For branch 2.1, OneVsRest should support setWeightCol Jul 28, 2017

test("SPARK-21306: OneVsRest should support setWeightCol") {
val dataset2 = dataset.withColumn("weight", lit(1))
val dataset2 = dataset.withColumn("weight", lit(1.0))
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

@yanboliang
Copy link
Contributor

Jenkins, test this please.

@yanboliang
Copy link
Contributor

@srowen Could you help to trigger this job? Thanks.

@SparkQA
Copy link

SparkQA commented Jul 31, 2017

Test build #3866 has finished for PR 18763 at commit 571739d.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yanboliang
Copy link
Contributor

Jenkins, test this please.

weightCol = self.getWeightCol()
else:
warnings.warn("weightCol is ignored, "
"as it is not supported by {} now.".format(classifier))
Copy link
Contributor

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))

FYI https://stackoverflow.com/questions/21034954/valueerror-zero-length-field-name-in-format-in-python2-6-6

Copy link
Contributor Author

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!

@yanboliang
Copy link
Contributor

ok to test

@yanboliang
Copy link
Contributor

Jenkins, test this please.

@gatorsmile
Copy link
Member

ok to test

@SparkQA
Copy link

SparkQA commented Aug 7, 2017

Test build #80345 has finished for PR 18763 at commit d6ce47b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

asfgit pushed a commit that referenced this pull request Aug 8, 2017
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.
@yanboliang
Copy link
Contributor

Merged into branch-2.1. Thanks @facaiy @gatorsmile

@yanboliang
Copy link
Contributor

It seems github can't close this PR automatically. @facaiy Please feel free to close it manually. Thanks.

@facaiy
Copy link
Contributor Author

facaiy commented Aug 8, 2017

Thanks, all.

@facaiy facaiy closed this Aug 8, 2017
@facaiy facaiy deleted the BUG/branch-2.1_OneVsRest_support_setWeightCol branch August 8, 2017 08:08
jzhuge pushed a commit to jzhuge/spark that referenced this pull request Aug 20, 2018
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants