Uh oh!
There was an error while loading. Please reload this page.
[SPARK-15819][PYSPARK][ML] Add KMeanSummary in KMeans of PySpark - #13557
[SPARK-15819][PYSPARK][ML] Add KMeanSummary in KMeans of PySpark#13557zjffdu wants to merge 9 commits into
Conversation
SparkQA
commented
Jun 8, 2016
Test build #60157 has finished for PR 13557 at commit
|
SparkQA
commented
Jun 8, 2016
Test build #60160 has finished for PR 13557 at commit
|
SparkQA
commented
Jun 8, 2016
Test build #60163 has finished for PR 13557 at commit
|
SparkQA
commented
Jun 8, 2016
Test build #60167 has finished for PR 13557 at commit
|
SparkQA
commented
Jun 8, 2016
Test build #60171 has finished for PR 13557 at commit
|
SparkQA
commented
Jun 8, 2016
Test build #60175 has finished for PR 13557 at commit
|
SparkQA
commented
Jun 9, 2016
Test build #60236 has finished for PR 13557 at commit
|
zjffdu
commented
Jun 11, 2016
@jkbradley Could you help review it ? Thanks |
jkbradley
commented
Jun 17, 2016
Sorry for the delay! I'll try to review it as soon as QA for 2.0 is done. |
zjffdu
commented
Aug 11, 2016
PR rebased, ping @jkbradley Please help review when you have time. |
SparkQA
commented
Aug 11, 2016
Test build #63600 has finished for PR 13557 at commit
|
There was a problem hiding this comment.
We are now post 2.0, so we will need to update the since annotations.
There was a problem hiding this comment.
same for versionadded need to be updated
There was a problem hiding this comment.
Maybe good to add a notice this causes an exception if there is no summary present (as done in the scala docs).
SparkQA
commented
Oct 17, 2016
Test build #67048 has finished for PR 13557 at commit
|
There was a problem hiding this comment.
So in the other random files I sampled in this directory we only have one new line, was there a reason for this change?
SparkQA
commented
Oct 18, 2016
Test build #67127 has finished for PR 13557 at commit
|
zjffdu
commented
Oct 21, 2016
ping @jkbradley@holdenk |
yanboliang
commented
Oct 26, 2016
jenkins test this please. |
SparkQA
commented
Oct 26, 2016
Test build #67585 has finished for PR 13557 at commit
|
There was a problem hiding this comment.
Could you please add a unit test (not a doc test) to make sure this works for both cases, with and without a summary? It looks like it will throw an error if there is no summary.
There was a problem hiding this comment.
Good point. Other summaries have implemented this method by calling:
returnself._call_java("hasSummary")About the unit test - how can you create a situation where the model does not have a summary?
There was a problem hiding this comment.
@zjffdu Can you make this match the other summary implementations? i.e. self._call_java("hasSummary")
sethah
commented
Nov 5, 2016
I created SPARK-18282 and the PR: #15777 to implement this interface for GMM and BisectingKMeans. These two PRs will affect one another, I'm not sure it matters too much which gets merged first, but whichever one does get merged first needs to implement a parent class |
yanboliang
commented
Nov 14, 2016
ping @zjffdu Could you address @jkbradley 's comment, then I can help to get this in. It's better we can merge this into Spark 2.1. Thanks. |
holdenk
commented
Nov 24, 2016
SparkQA
commented
Nov 28, 2016
Test build #69245 has finished for PR 13557 at commit
|
SparkQA
commented
Nov 28, 2016
Test build #69246 has finished for PR 13557 at commit
|
There was a problem hiding this comment.
@zjffdu Can you make this match the other summary implementations? i.e. self._call_java("hasSummary")
| >>> df = spark.createDataFrame(data, ["features"]) | ||
| >>> kmeans = KMeans(k=2, seed=1) | ||
| >>> model = kmeans.fit(df) | ||
| >>> summary = model.summary |
There was a problem hiding this comment.
Can we make this doc test the same as the other clustering classes? We should test model.hasSummary before and after save/load as was done in the other implementations. Also, we need to add a test to tests.py for this summary (see that file and reference the other summary tests).
| >>> summary = model.summary | ||
| >>> summary.k | ||
| 2 | ||
| >>> summary.predictionCol |
There was a problem hiding this comment.
things like this are better left for the tests.py file IMO, since this shows up in the doc and might not be useful to users
| @property | ||
| @since("2.1.0") | ||
| def summary(self): |
There was a problem hiding this comment.
Can you match the other implementations here as well?
SparkQA
commented
Nov 29, 2016
Test build #69291 has finished for PR 13557 at commit
|
SparkQA
commented
Nov 29, 2016
Test build #69292 has finished for PR 13557 at commit
|
zjffdu
commented
Nov 29, 2016
@sethah Thanks for the review, I have updated the PR. |
SparkQA
commented
Nov 29, 2016
Test build #69302 has finished for PR 13557 at commit
|
sethah
left a comment
There was a problem hiding this comment.
Just a few small things. I think it would be nice to get this into 2.1 considering we have the other summaries implemented, but if it slips we have to update the version tags.
There was a problem hiding this comment.
Let's move it after the KMeans class like the others.
There was a problem hiding this comment.
Add
>>>model.hasSummaryTrue>>>summary=model.summary>>>summary.k2>>>summary.clusterSizes
[2, 2]to match other doctests
SparkQA
commented
Nov 30, 2016
Test build #69368 has finished for PR 13557 at commit
|
yanboliang
commented
Nov 30, 2016
LGTM, merged into master and branch-2.1. Thank you all. |
## What changes were proposed in this pull request? Add python api for KMeansSummary ## How was this patch tested? unit test added Author: Jeff Zhang <zjffdu@apache.org> Closes#13557 from zjffdu/SPARK-15819. (cherry picked from commit 4c82ca8) Signed-off-by: Yanbo Liang <ybliang8@gmail.com>
## What changes were proposed in this pull request? Add python api for KMeansSummary ## How was this patch tested? unit test added Author: Jeff Zhang <zjffdu@apache.org> Closesapache#13557 from zjffdu/SPARK-15819.
## What changes were proposed in this pull request? Add python api for KMeansSummary ## How was this patch tested? unit test added Author: Jeff Zhang <zjffdu@apache.org> Closesapache#13557 from zjffdu/SPARK-15819.
What changes were proposed in this pull request?
Add python api for KMeansSummary
How was this patch tested?
unit test added