BryanCutler commented on a change in pull request #26527:
[SPARK-29691][ML][PYTHON] ensure Param objects are valid in fit, transform
URL: https://github.com/apache/spark/pull/26527#discussion_r347547769
##########
File path: python/pyspark/ml/param/__init__.py
##########
@@ -484,8 +484,16 @@ def _copyValues(self, to, extra=None):
:return: the target instance with param values copied
"""
paramMap = self._paramMap.copy()
- if extra is not None:
- paramMap.update(extra)
+ if isinstance(extra, dict):
+ for param, value in extra.items():
+ if isinstance(param, Param):
+ paramMap[param] = value
+ else:
+ raise ValueError("Expecting a valid instance of Param, but
received: {}"
Review comment:
This should be a `TypeError` since it is due to type checking
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]