spark-instrumented-optimizer/python/pyspark/ml
sethah b354673886 [SPARK-13047][PYSPARK][ML] Pyspark Params.hasParam should not throw an error
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:
```python
from pyspark.ml.classification import NaiveBayes
nb = NaiveBayes()
print nb.hasParam("smoothing")
print nb.hasParam("notAParam")
```
produces:
> True
> AttributeError: 'NaiveBayes' object has no attribute 'notAParam'

However, in Scala:
```scala
import org.apache.spark.ml.classification.NaiveBayes
val nb  = new NaiveBayes()
nb.hasParam("smoothing")
nb.hasParam("notAParam")
```
produces:
> true
> false

cc holdenk

Author: sethah <seth.hendrickson16@gmail.com>

Closes #10962 from sethah/SPARK-13047.
2016-02-11 16:42:44 -08:00
..
param [SPARK-13047][PYSPARK][ML] Pyspark Params.hasParam should not throw an error 2016-02-11 16:42:44 -08:00
__init__.py [SPARK-7535] [.0] [MLLIB] Audit the pipeline APIs for 1.4 2015-05-21 22:57:33 -07:00
classification.py [SPARK-10509][PYSPARK] Reduce excessive param boiler plate code 2016-01-26 15:53:48 -08:00
clustering.py [SPARK-13035][ML][PYSPARK] PySpark ml.clustering support export/import 2016-02-11 15:55:40 -08:00
evaluation.py [SPARK-10509][PYSPARK] Reduce excessive param boiler plate code 2016-01-26 15:53:48 -08:00
feature.py [SPARK-12780] Inconsistency returning value of ML python models' properties 2016-01-26 21:16:56 -08:00
pipeline.py [SPARK-10509][PYSPARK] Reduce excessive param boiler plate code 2016-01-26 15:53:48 -08:00
recommendation.py [SPARK-13037][ML][PYSPARK] PySpark ml.recommendation support export/import 2016-02-11 15:50:33 -08:00
regression.py [SPARK-13032][ML][PYSPARK] PySpark support model export/import and take LinearRegression as example 2016-01-29 09:22:24 -08:00
tests.py [SPARK-13047][PYSPARK][ML] Pyspark Params.hasParam should not throw an error 2016-02-11 16:42:44 -08:00
tuning.py [SPARK-10509][PYSPARK] Reduce excessive param boiler plate code 2016-01-26 15:53:48 -08:00
util.py [SPARK-13032][ML][PYSPARK] PySpark support model export/import and take LinearRegression as example 2016-01-29 09:22:24 -08:00
wrapper.py [SPARK-13032][ML][PYSPARK] PySpark support model export/import and take LinearRegression as example 2016-01-29 09:22:24 -08:00