Skip to content

[SPARK-11922][PYSPARK][ML] Python api for ml.feature.quantile discretizer - #10085

Closed
holdenk wants to merge 16 commits into
apache:masterfrom
holdenk:SPARK-11937-SPARK-11922-Python-API-for-ml.feature.QuantileDiscretizer
Closed

[SPARK-11922][PYSPARK][ML] Python api for ml.feature.quantile discretizer#10085
holdenk wants to merge 16 commits into
apache:masterfrom
holdenk:SPARK-11937-SPARK-11922-Python-API-for-ml.feature.QuantileDiscretizer

Conversation

@holdenk

Copy link
Copy Markdown
Contributor

Add Python API for ml.feature.QuantileDiscretizer.

One open question: Do we want to do this stuff to re-use the java model, create a new model, or use a different wrapper around the java model.
cc @brkyvz & @mengxr

…ectizer. One question (for review) is do we want to change the bucketizer as I've done or create a different wrapper? I think this way is better but it does introduce an extra param so no sure
… a param, print out the splits from the trained bucketizer
@SparkQA

Copy link
Copy Markdown

Test build #47026 has finished for PR 10085 at commit 2540101.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):\n * class QuantileDiscretizer(JavaEstimator, HasInputCol, HasOutputCol):\n

@SparkQA

Copy link
Copy Markdown

Test build #47030 has finished for PR 10085 at commit 1145ec4.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):\n * class QuantileDiscretizer(JavaEstimator, HasInputCol, HasOutputCol):\n

@SparkQA

Copy link
Copy Markdown

Test build #47031 has finished for PR 10085 at commit 2afd197.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):\n * class QuantileDiscretizer(JavaEstimator, HasInputCol, HasOutputCol):\n

@holdenk

Copy link
Copy Markdown
ContributorAuthor

cc @yanboliang who filed the JIRA for this.

@jkbradley

Copy link
Copy Markdown
Member

Can you please only link to the specific JIRA, not the umbrella?

@yinxusen

Copy link
Copy Markdown
Contributor

Hi @holdenk, I think the PR is duplicated with mine: #10007

@yinxusen

Copy link
Copy Markdown
Contributor

OK, I was not realized that there is an umbrella JIRA for this. I'll close mine.

@yinxusen

Copy link
Copy Markdown
Contributor

@holdenk For your questions, I first tried to modify the interface of Bucketizer, making it to a JavaModel other than a JavaTransfomer. But I finally decided not to touch the Bucketizer, and added a inner class of QuantileDiscretizerModel to get the splits.

But I recommend to test the getSplits of Bucketizer that generating from the QuantileDiscretizer, since I got a serialization error, and I added a getJavaSplits to avoide it. JIRA issue here.

@holdenkholdenk changed the title [SPARK-11937][SPARK-11922][PYSPARK][ML] Python api for ml.feature.quantile discretizer[SPARK-11922][PYSPARK][ML] Python api for ml.feature.quantile discretizerDec 8, 2015
@yanboliang

Copy link
Copy Markdown
Contributor

I vote for making Bucketizer to a Model rather than Transformer which is consistent with Scala code. @yinxusen Could you let us know the reason that you give up this proposal?

@yinxusen

Copy link
Copy Markdown
Contributor

@yanboliang I am OK to change Bucketizer to a JavaModel. At that time I just do not want to change that piece of code. That's also why I closed my PR because I think @holdenk's implementation is better. But like what I said, be careful with getSplits. :)Cross it since this implementation avoid the serialization problem.

@holdenk

Copy link
Copy Markdown
ContributorAuthor

Ok - just to make sure do you see any issues with the current approach for getSplits? Its tested a bit in the doctests but if there is a potential issue I can add some more tests.

@yinxusen

Copy link
Copy Markdown
Contributor

@holdenk No more issue in getSplits. It looks good.

@holdenk

Copy link
Copy Markdown
ContributorAuthor

@yinxusen thanks :)

@holdenk

Copy link
Copy Markdown
ContributorAuthor

cc @yanboliang if you have a chance to take a look

@holdenk

Copy link
Copy Markdown
ContributorAuthor

re-ping @yanboliang or @jkbradley if you've got the time to look at this (already been reviewed a bit).

@SparkQA

Copy link
Copy Markdown

Test build #48495 has finished for PR 10085 at commit 601a9ea.

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

@SparkQA

Copy link
Copy Markdown

Test build #49177 has finished for PR 10085 at commit 798798c.

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

@holdenk

Copy link
Copy Markdown
ContributorAuthor

re-ping @jkbradley ?

@jkbradley

Copy link
Copy Markdown
Member

I'll try to check this soon, but have some others first. It will be great if someone else can review this PR in the meantime. @yinxusen Would you have time? Thanks!

@yinxusen

Copy link
Copy Markdown
Contributor

@jkbradley I'll help you reviewing this.

Comment threadpython/pyspark/ml/feature.py Outdated

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.

Should we add a default 2 here?

Comment threadpython/pyspark/ml/feature.py Outdated

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.

change it to 2.0.0.

@yinxusen

Copy link
Copy Markdown
Contributor

@jkbradley LGTM except for the version labels.

@holdenk

Copy link
Copy Markdown
ContributorAuthor

@yinxusen /@jkbradley updated the version added tag to 2.0.0 :)

@SparkQA

Copy link
Copy Markdown

Test build #49534 has finished for PR 10085 at commit 5e18778.

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

@dbtsai

Copy link
Copy Markdown
Member

LGTM as well! Thanks.

Comment threadpython/pyspark/ml/feature.py Outdated

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.

Why is _java_model needed? It does not seem to be used.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Oh yah, I think the original plan was to avoid the overhead of object creation and sending the params back to the JVM if it is supplied since we already had a transformer. I'll remove this.

@jkbradley

Copy link
Copy Markdown
Member

Those are the only issues I see. Thanks everyone for reviewing & @holdenk for the PR!

@SparkQA

Copy link
Copy Markdown

Test build #49694 has finished for PR 10085 at commit f21ebef.

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

@SparkQA

Copy link
Copy Markdown

Test build #49719 has finished for PR 10085 at commit f9e3086.

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

@SparkQA

Copy link
Copy Markdown

Test build #49726 has finished for PR 10085 at commit 194ec6d.

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

@holdenk

Copy link
Copy Markdown
ContributorAuthor

Think I addressed all of @jkbradley's comments

@SparkQA

Copy link
Copy Markdown

Test build #50015 has finished for PR 10085 at commit 463aa37.

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

@holdenk

Copy link
Copy Markdown
ContributorAuthor

seems unrelated, jenkins retest this please.

@SparkQA

Copy link
Copy Markdown

Test build #50037 has finished for PR 10085 at commit 463aa37.

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

@jkbradley

Copy link
Copy Markdown
Member

LGTM
Merging with master
Thanks for the PR!

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.

6 participants

@holdenk@SparkQA@jkbradley@yinxusen@yanboliang@dbtsai