[jira] [Updated] (SPARK-13047) Pyspark Params.hasParam should not throw an error
[ https://issues.apache.org/jira/browse/SPARK-13047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Seth Hendrickson updated SPARK-13047: - Description: Pyspark {{Params}} class has a method {{hasParam(paramName)}} which returns True if the class has a parameter by that name, but throws an {{AttributeError}} otherwise. There is not currently a way of getting a Boolean to indicate if a class has a parameter. With Spark 2.0 we could modify the existing behavior of {{hasParam}} or add an additional method with this functionality. In Python: {code} from pyspark.ml.classification import NaiveBayes nb = NaiveBayes(smoothing=0.5) print nb.hasParam("smoothing") print nb.hasParam("notAParam") {code} produces: > True > AttributeError: 'NaiveBayes' object has no attribute 'notAParam' However, in Scala: {code} import org.apache.spark.ml.classification.NaiveBayes val nb = new NaiveBayes() nb.hasParam("smoothing") nb.hasParam("notAParam") {code} produces: > true > false was:Pyspark {{Params}} class has a method {{hasParam(paramName)}} which returns True if the class has a parameter by that name, but throws an {{AttributeError}} otherwise. There is not currently a way of getting a Boolean to indicate if a class has a parameter. With Spark 2.0 we could modify the existing behavior of {{hasParam}} or add an additional method with this functionality. > Pyspark Params.hasParam should not throw an error > - > > Key: SPARK-13047 > URL: https://issues.apache.org/jira/browse/SPARK-13047 > Project: Spark > Issue Type: Bug > Components: ML, PySpark >Reporter: Seth Hendrickson >Priority: Minor > > Pyspark {{Params}} class has a method {{hasParam(paramName)}} which returns > True if the class has a parameter by that name, but throws an > {{AttributeError}} otherwise. There is not currently a way of getting a > Boolean to indicate if a class has a parameter. With Spark 2.0 we could > modify the existing behavior of {{hasParam}} or add an additional method with > this functionality. > In Python: > {code} > from pyspark.ml.classification import NaiveBayes > nb = NaiveBayes(smoothing=0.5) > print nb.hasParam("smoothing") > print nb.hasParam("notAParam") > {code} > produces: > > True > > AttributeError: 'NaiveBayes' object has no attribute 'notAParam' > However, in Scala: > {code} > import org.apache.spark.ml.classification.NaiveBayes > val nb = new NaiveBayes() > nb.hasParam("smoothing") > nb.hasParam("notAParam") > {code} > produces: > > true > > false -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Updated] (SPARK-13047) Pyspark Params.hasParam should not throw an error
[ https://issues.apache.org/jira/browse/SPARK-13047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiangrui Meng updated SPARK-13047: -- Target Version/s: 1.6.1 > Pyspark Params.hasParam should not throw an error > - > > Key: SPARK-13047 > URL: https://issues.apache.org/jira/browse/SPARK-13047 > Project: Spark > Issue Type: Bug > Components: ML, PySpark >Reporter: Seth Hendrickson >Priority: Minor > > Pyspark {{Params}} class has a method {{hasParam(paramName)}} which returns > True if the class has a parameter by that name, but throws an > {{AttributeError}} otherwise. There is not currently a way of getting a > Boolean to indicate if a class has a parameter. With Spark 2.0 we could > modify the existing behavior of {{hasParam}} or add an additional method with > this functionality. > In Python: > {code} > from pyspark.ml.classification import NaiveBayes > nb = NaiveBayes(smoothing=0.5) > print nb.hasParam("smoothing") > print nb.hasParam("notAParam") > {code} > produces: > > True > > AttributeError: 'NaiveBayes' object has no attribute 'notAParam' > However, in Scala: > {code} > import org.apache.spark.ml.classification.NaiveBayes > val nb = new NaiveBayes() > nb.hasParam("smoothing") > nb.hasParam("notAParam") > {code} > produces: > > true > > false -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Updated] (SPARK-13047) Pyspark Params.hasParam should not throw an error
[ https://issues.apache.org/jira/browse/SPARK-13047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiangrui Meng updated SPARK-13047: -- Assignee: Seth Hendrickson > Pyspark Params.hasParam should not throw an error > - > > Key: SPARK-13047 > URL: https://issues.apache.org/jira/browse/SPARK-13047 > Project: Spark > Issue Type: Bug > Components: ML, PySpark >Reporter: Seth Hendrickson >Assignee: Seth Hendrickson >Priority: Minor > > Pyspark {{Params}} class has a method {{hasParam(paramName)}} which returns > True if the class has a parameter by that name, but throws an > {{AttributeError}} otherwise. There is not currently a way of getting a > Boolean to indicate if a class has a parameter. With Spark 2.0 we could > modify the existing behavior of {{hasParam}} or add an additional method with > this functionality. > In Python: > {code} > from pyspark.ml.classification import NaiveBayes > nb = NaiveBayes(smoothing=0.5) > print nb.hasParam("smoothing") > print nb.hasParam("notAParam") > {code} > produces: > > True > > AttributeError: 'NaiveBayes' object has no attribute 'notAParam' > However, in Scala: > {code} > import org.apache.spark.ml.classification.NaiveBayes > val nb = new NaiveBayes() > nb.hasParam("smoothing") > nb.hasParam("notAParam") > {code} > produces: > > true > > false -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Updated] (SPARK-13047) Pyspark Params.hasParam should not throw an error
[ https://issues.apache.org/jira/browse/SPARK-13047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Xiangrui Meng updated SPARK-13047: -- Target Version/s: 1.6.1, 2.0.0 (was: 1.6.1) > Pyspark Params.hasParam should not throw an error > - > > Key: SPARK-13047 > URL: https://issues.apache.org/jira/browse/SPARK-13047 > Project: Spark > Issue Type: Bug > Components: ML, PySpark >Reporter: Seth Hendrickson >Priority: Minor > > Pyspark {{Params}} class has a method {{hasParam(paramName)}} which returns > True if the class has a parameter by that name, but throws an > {{AttributeError}} otherwise. There is not currently a way of getting a > Boolean to indicate if a class has a parameter. With Spark 2.0 we could > modify the existing behavior of {{hasParam}} or add an additional method with > this functionality. > In Python: > {code} > from pyspark.ml.classification import NaiveBayes > nb = NaiveBayes(smoothing=0.5) > print nb.hasParam("smoothing") > print nb.hasParam("notAParam") > {code} > produces: > > True > > AttributeError: 'NaiveBayes' object has no attribute 'notAParam' > However, in Scala: > {code} > import org.apache.spark.ml.classification.NaiveBayes > val nb = new NaiveBayes() > nb.hasParam("smoothing") > nb.hasParam("notAParam") > {code} > produces: > > true > > false -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org