Skip to content

[SPARK-19234][MLLib] AFTSurvivalRegression should fail fast when any labels are zero - #16652

Closed
admackin wants to merge 6 commits into
apache:masterfrom
admackin:master
Closed

[SPARK-19234][MLLib] AFTSurvivalRegression should fail fast when any labels are zero#16652
admackin wants to merge 6 commits into
apache:masterfrom
admackin:master

Conversation

@admackin

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

If any labels of 0.0 (which are invalid) are supplied, AFTSurvivalRegression gives an error straight away rather than hard-to-interpret warnings and zero-valued coefficients in the output.

How was this patch tested?

Verified against current test suite. (One test needed to be updated as it was providing values of zero for labels so was failing after this patch)

Please review http://spark.apache.org/contributing.html before opening a pull request.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(Leave the blank)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is still causing a style check failure @admackin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is being copied in from MLUtils? why is it necessary?

@admackin

Copy link
Copy Markdown
ContributorAuthor

Yes, the version in MLUtils had labels of zero in the test cases, so was causing test cases to fail after my patch. It didn't look like there was a way to fix this, so I thought it better to make a patch that didn't affect potentially dozens of other packages. Any other thoughts on how to achieve this? I could add a 'minLabel' param to the MLUtils methods but that seems overly specific for this one package.

@srowen

Copy link
Copy Markdown
Member

I imagine there's a better way to do this without copying code. Do you mean the common test code assumes 0 labels are permitted? then maybe it should just not do that, because it's just using any old value to test.

If it doesn't actually assume 0 labels are permitted, then its logic should still work. It's just that this test would need some additional logic to verify that 0 labels cause an exception.

@admackin

admackin commented Jan 21, 2017 via email

Copy link
Copy Markdown
ContributorAuthor

@srowen

Copy link
Copy Markdown
Member

It looks like there is no particular reason that ("0", Vectors.dense(0, 2, 3), 0.0) really needs to set a 0 value as the label. You could make it 1 and see that it still passes all tests.

@SparkQA

Copy link
Copy Markdown

Test build #3544 has finished for PR 16652 at commit b07c281.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@admackin

Copy link
Copy Markdown
ContributorAuthor

I've addressed all the problems I think – code style now fixed, MLTestingUtils patched (and verified all MLLib test cases still pass), and added a test case for zero-valued labels

@srowen

Copy link
Copy Markdown
Member

This is looking OK to me, but it needs a (squash, optionally, and) rebase now before it can test again.

@SparkQA

Copy link
Copy Markdown

Test build #3551 has finished for PR 16652 at commit cfdd286.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

(0.000, 0.0, Vectors.dense(0.346, 2.158)), // ← generates error; zero labels invalid
(4.199, 0.0, Vectors.dense(0.795, -0.226)))).toDF("label", "censor", "features")
val aft = new AFTSurvivalRegression()
intercept[SparkException] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's recommended to verify the error message using withClue, eg:
withClue("label of AFTPoint must be positive") {
intercept[SparkException] {
aft.fit(dataset)
}
}

@imatiach-msft

Copy link
Copy Markdown
Contributor

looks good to me too. I just added a small suggestion. Thanks!

@SparkQA

Copy link
Copy Markdown

Test build #3552 has finished for PR 16652 at commit c855976.

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

@SparkQA

Copy link
Copy Markdown

Test build #3554 has finished for PR 16652 at commit c855976.

  • This patch fails PySpark unit tests.
  • This patch does not merge cleanly.
  • This patch adds no public classes.

@srowen

Copy link
Copy Markdown
Member

The core change is looking OK @admackin but seems like it fails Python tests? if you have a moment to look at that, could be all that's needed to get this over the line.

@HyukjinKwon

Copy link
Copy Markdown
Member

gentle ping @admackin

@HyukjinKwonHyukjinKwon mentioned this pull request May 17, 2017
zifeif2 pushed a commit to zifeif2/spark that referenced this pull request Nov 22, 2025
## What changes were proposed in this pull request?
This PR proposes to close PRs ...
- inactive to the review comments more than a month
- WIP and inactive more than a month
- with Jenkins build failure but inactive more than a month
- suggested to be closed and no comment against that
- obviously looking inappropriate (e.g., Branch 0.5)
To make sure, I left a comment for each PR about a week ago and I could not have a response back from the author in these PRs below:
Closesapache#11129Closesapache#12085Closesapache#12162Closesapache#12419Closesapache#12420Closesapache#12491Closesapache#13762Closesapache#13837Closesapache#13851Closesapache#13881Closesapache#13891Closesapache#13959Closesapache#14091Closesapache#14481Closesapache#14547Closesapache#14557Closesapache#14686Closesapache#15594Closesapache#15652Closesapache#15850Closesapache#15914Closesapache#15918Closesapache#16285Closesapache#16389Closesapache#16652Closesapache#16743Closesapache#16893Closesapache#16975Closesapache#17001Closesapache#17088Closesapache#17119Closesapache#17272Closesapache#17971
Added:
Closesapache#17778Closesapache#17303Closesapache#17872
## How was this patch tested?
N/A
Author: hyukjinkwon <gurwls223@gmail.com>
Closesapache#18017 from HyukjinKwon/close-inactive-prs.
Sign up for freeto 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.

5 participants

@admackin@srowen@SparkQA@imatiach-msft@HyukjinKwon