diff options
-rw-r--r-- | python/pyspark/ml/wrapper.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/python/pyspark/ml/wrapper.py b/python/pyspark/ml/wrapper.py index d4d48eb215..f8feaa1dfa 100644 --- a/python/pyspark/ml/wrapper.py +++ b/python/pyspark/ml/wrapper.py @@ -79,8 +79,9 @@ class JavaWrapper(Params): for param in self.params: if self._java_obj.hasParam(param.name): java_param = self._java_obj.getParam(param.name) - value = _java2py(sc, self._java_obj.getOrDefault(java_param)) - self._paramMap[param] = value + if self._java_obj.isDefined(java_param): + value = _java2py(sc, self._java_obj.getOrDefault(java_param)) + self._paramMap[param] = value @staticmethod def _empty_java_param_map(): |