Skip to content
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-32310][ML][PySpark][3.0] ML params default value parity #29159

Closed
wants to merge 4 commits into from

Conversation

huaxingao
Copy link
Contributor

What changes were proposed in this pull request?

backporting the changes to 3.0
set params default values in trait Params for feature and tuning in both Scala and Python.

Why are the changes needed?

Make ML has the same default param values between estimator and its corresponding transformer, and also between Scala and Python.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing and modified tests

@huaxingao
Copy link
Contributor Author

cc @srowen @viirya @zhengruifeng

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126152 has finished for PR 29159 at commit f657d77.

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

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126158 has finished for PR 29159 at commit 16abf9c.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@zhengruifeng
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126176 has finished for PR 29159 at commit 16abf9c.

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

@srowen
Copy link
Member

srowen commented Jul 20, 2020

Jenkins retest this please

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126189 has finished for PR 29159 at commit 16abf9c.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126192 has finished for PR 29159 at commit 16abf9c.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126193 has finished for PR 29159 at commit 16abf9c.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126201 has finished for PR 29159 at commit 16abf9c.

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

@viirya
Copy link
Member

viirya commented Jul 20, 2020

retest this please

@viirya
Copy link
Member

viirya commented Jul 20, 2020

For backport PR, can you add [3.0] to the PR title?

@viirya
Copy link
Member

viirya commented Jul 20, 2020

Is this just a backport of #29112? Looks it it is bigger change than #29112?

@huaxingao
Copy link
Contributor Author

huaxingao commented Jul 20, 2020

@viirya It's backporting #29112 and #29153. I haven't finished #29153 yet. I want to finish 3.0 first because seems the plan is to cut 3.0.1 pretty soon.

@huaxingao huaxingao changed the title [SPARK-32310][ML][PySpark] ML params default value parity [SPARK-32310][ML][PySpark][3.0] ML params default value parity Jul 20, 2020
@SparkQA
Copy link

SparkQA commented Jul 20, 2020

Test build #126203 has finished for PR 29159 at commit 16abf9c.

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

@Fokko
Copy link
Contributor

Fokko commented Jul 21, 2020

#29122 Isn't included in the PR AFAIK. I think it is a typo, it is #29112.

@huaxingao
Copy link
Contributor Author

Sorry, fixed. @Fokko

@@ -64,7 +64,12 @@ trait DefaultReadWriteTest extends TempDirectory { self: Suite =>
case (Array(values), Array(newValues)) =>
assert(values === newValues, s"Values do not match on param ${p.name}.")
case (value, newValue) =>
assert(value === newValue, s"Values do not match on param ${p.name}.")
if (value.isInstanceOf[Double] && value.asInstanceOf[Double].isNaN) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this check?

If necessary, may change to:

case (value: Double, newValue: Double) =>
      assert(value.isNaN && newValue.isNaN || value == newValue, ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before my change, this setDefault(strategy -> Imputer.mean, missingValue -> Double.NaN) is in Imputer. Now I moved this to ImputerParams so ImputerModel also has the default value of missingValue set to Double.NaN. In DefaultReadWriteTest, it compares the default value of missingValue in the original model and the loaded model, so I need to make the NaN comparison work.

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126304 has finished for PR 29159 at commit 52dd9b4.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126342 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126346 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126351 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126353 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126357 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

retest this please

@@ -545,6 +551,10 @@ class _TrainValidationSplitParams(_ValidatorParams):
trainRatio = Param(Params._dummy(), "trainRatio", "Param for ratio between train and\
validation data. Must be between 0 and 1.", typeConverter=TypeConverters.toFloat)

def __init__(self, *args):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added *args many places. Just to make sure it is for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's for consistency.

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126362 has finished for PR 29159 at commit 52dd9b4.

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

@viirya
Copy link
Member

viirya commented Jul 22, 2020

retest this please

Copy link
Member

@viirya viirya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

@SparkQA
Copy link

SparkQA commented Jul 22, 2020

Test build #126365 has finished for PR 29159 at commit 52dd9b4.

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

@viirya
Copy link
Member

viirya commented Jul 22, 2020

retest this please

@SparkQA
Copy link

SparkQA commented Jul 23, 2020

Test build #126366 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

Jenkins, please make pip packaging tests pass! retest this please

@SparkQA
Copy link

SparkQA commented Jul 23, 2020

Test build #126367 has finished for PR 29159 at commit 52dd9b4.

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

@huaxingao
Copy link
Contributor Author

@srowen Are you Okay with this?

@srowen
Copy link
Member

srowen commented Jul 24, 2020

Same as the version for master - looks OK if there are no API or behavior changes (that are not bug fixes).

huaxingao added a commit that referenced this pull request Jul 24, 2020
### What changes were proposed in this pull request?
backporting the changes to 3.0
set params default values in trait Params for feature and tuning in both Scala and Python.

### Why are the changes needed?
Make ML has the same default param values between estimator and its corresponding transformer, and also between Scala and Python.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Existing and modified tests

Closes #29159 from huaxingao/set_default_3.0.

Authored-by: Huaxin Gao <huaxing@us.ibm.com>
Signed-off-by: Huaxin Gao <huaxing@us.ibm.com>
@huaxingao
Copy link
Contributor Author

Merged to 3.0. Thank you all for reviewing!

@huaxingao huaxingao closed this Jul 24, 2020
@huaxingao huaxingao deleted the set_default_3.0 branch July 24, 2020 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants