spark-instrumented-optimizer/python/pyspark/ml/param
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
..
__init__.py [SPARK-13047][PYSPARK][ML] Pyspark Params.hasParam should not throw an error 2016-02-11 16:42:44 -08:00
_shared_params_code_gen.py [SPARK-10509][PYSPARK] Reduce excessive param boiler plate code 2016-01-26 15:53:48 -08:00
shared.py [SPARK-10509][PYSPARK] Reduce excessive param boiler plate code 2016-01-26 15:53:48 -08:00