Uh oh!
There was an error while loading. Please reload this page.
[SPARK-17086][ML] Fix InvalidArgumentException issue in QuantileDiscretizer when some quantiles are duplicated - #14747
[SPARK-17086][ML] Fix InvalidArgumentException issue in QuantileDiscretizer when some quantiles are duplicated #14747VinceShieh wants to merge 1 commit into
Conversation
srowen
commented
Aug 22, 2016
Hm, does |
srowen
commented
Aug 22, 2016
Jenkins add to whitelist |
VinceShieh
commented
Aug 22, 2016
yes, the output from approxQuantile is a sorted array. |
srowen
commented
Aug 22, 2016
No, my question is whether it remains sorted after |
VinceShieh
commented
Aug 22, 2016
it seems Array.distinct will not break the sequence of the elements. But, you are right, we need guarantee the array is sorted. |
There was a problem hiding this comment.
Hm, I'm not sure why the tests write this. It shouldn't be needed. Leave it for now I guess
srowen
commented
Aug 22, 2016
LGTM |
There was a problem hiding this comment.
I'm more prefer to leave warning log for this condition. Since if users set numBuckets = 10, and then get buckets with less than the numBuckets, it will confuse users. What about your thoughts? @srowen
There was a problem hiding this comment.
I think that's reasonable, to warn in this case. It shouldn't be too noisy because this case is rare.
SparkQA
commented
Aug 22, 2016
Test build #64184 has finished for PR 14747 at commit
|
There was a problem hiding this comment.
Nit: space after "if". Also this could state the number of resulting buckets, since it definitely will happen:
log.warn(s"Some quantiles were identical. Bucketing to ${splits.length - 1} buckets as a result.")
Finally, please update the title of the PR to match the JIRA, which is more descriptive as a commit log message.
SparkQA
commented
Aug 22, 2016
Test build #64186 has finished for PR 14747 at commit
|
5f414b7 to
348436fCompareSparkQA
commented
Aug 22, 2016
Test build #64196 has finished for PR 14747 at commit
|
SparkQA
commented
Aug 22, 2016
Test build #64188 has finished for PR 14747 at commit
|
SparkQA
commented
Aug 22, 2016
Test build #64197 has finished for PR 14747 at commit
|
There was a problem hiding this comment.
Nit: you can use string interpolation here. That part was fine. s"... ${cutpoints.length - 1} ...". Super nit while we're still here: cutpoints is a term not used elsewhere. Just "distinctSplits"?
…les are duplicated QuantileDiscretizer.fit will throw an illegal exception when calling setSplits on a list of splits with duplicated elements. Bucketizer.setSplits should only accept either a numeric vector of two or more unique cut points, although that may produce less number of buckets than requested. Signed-off-by: VinceShieh <vincent.xie@intel.com>
SparkQA
commented
Aug 24, 2016
Test build #64323 has finished for PR 14747 at commit
|
srowen
commented
Aug 24, 2016
Merged to master |
…etizer when some quantiles are duplicated ## What changes were proposed in this pull request? In cases when QuantileDiscretizerSuite is called upon a numeric array with duplicated elements, we will take the unique elements generated from approxQuantiles as input for Bucketizer. ## How was this patch tested? An unit test is added in QuantileDiscretizerSuite QuantileDiscretizer.fit will throw an illegal exception when calling setSplits on a list of splits with duplicated elements. Bucketizer.setSplits should only accept either a numeric vector of two or more unique cut points, although that may produce less number of buckets than requested. Signed-off-by: VinceShieh <vincent.xieintel.com> Author: VinceShieh <vincent.xie@intel.com> Closes#14747 from VinceShieh/SPARK-17086. (cherry picked from commit 92c0eaf) Signed-off-by: Sean Owen <sowen@cloudera.com>
What changes were proposed in this pull request?
In cases when QuantileDiscretizerSuite is called upon a numeric array with duplicated elements, we will take the unique elements generated from approxQuantiles as input for Bucketizer.
How was this patch tested?
An unit test is added in QuantileDiscretizerSuite
QuantileDiscretizer.fit will throw an illegal exception when calling setSplits on a list of splits
with duplicated elements. Bucketizer.setSplits should only accept either a numeric vector of two
or more unique cut points, although that may produce less number of buckets than requested.
Signed-off-by: VinceShieh vincent.xie@intel.com