Uh oh!
There was an error while loading. Please reload this page.
[SPARK-17508][PYSPARK][ML] PySpark treat Param values None same as not setting the Param - #15113
[SPARK-17508][PYSPARK][ML] PySpark treat Param values None same as not setting the Param#15113BryanCutler wants to merge 1 commit into
Conversation
BryanCutler
commented
Sep 15, 2016
@srowen Here is the change that would treat PySpark Params with a value of |
SparkQA
commented
Sep 15, 2016
Test build #65458 has finished for PR 15113 at commit
|
@BryanCutler Thanks for working on this. I'm a bit worried that if users set LogisticRegression(maxIter=5, regParam=0.0, weightCol="weight")
LogisticRegression(maxIter=5, regParam=0.0, weightCol="") LogisticRegression(maxIter=5, regParam=0.0) And users are unlikely to write the following code: However, if users actually do this, I'm more likely to consider that he will forcibly specify |
yanboliang
commented
Sep 22, 2016
Further more, |
BryanCutler
commented
Sep 22, 2016
Hi @yanboliang , thanks for taking a look! Here it shows |
holdenk
commented
Oct 7, 2016
@yanboliang : I've certainly seen even Spark developers be tripped up with the handling of |
ueshin
commented
Jun 20, 2017
@BryanCutler Hi, are you still working on this? |
BryanCutler
commented
Jun 21, 2017
Hi @ueshin , there isn't anymore work for this, just a decision if this behavior should change. I still think it should and would like to hear some more opinions before I close this. Any thoughts @holdenk@jkbradley ? |
holdenk
commented
Jul 2, 2017
So I think our current handling of |
holdenk
commented
Apr 13, 2018
Is this PR still needed? |
BryanCutler
commented
Apr 17, 2018
I still think this makes sense, but maybe I'm the minority. I'll go ahead and close it unless anyone else thinks it should be changed. |
What changes were proposed in this pull request?
In PySpark, if params are set with a value of
Noneit will get converted by Py4J to a typed value and usually result in an error. For the case of string params, it will assign them anullvalue and lead to ajava.lang.NullPointerException. From the user perspective, this is not the expected outcome and can be confusing.This change causes PySpark to not set Params with a value of
None, and they will be treated the same as not being set. If a Param is already set, then attempting to set a value ofNonewill have no effect. This is mostly useful for a user that could be automating Param settings or wrapping classes that use Params.How was this patch tested?
Added new unit tests for setting a Param to
Noneand ran existing PySpark-ml tests.