JohnHBauer 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_r346930019
##########
File path: python/pyspark/ml/param/__init__.py
##########
@@ -484,8 +484,19 @@ 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
+ elif self.hasParam(param):
+ # set value by name if vaiid
+ paramMap[self.getParam(param)] = value
Review comment:
It can't be ambiguous in a pipeline: since `stages` is the only parameter
that pipeline has, that is the only parameter that could be set this way. If
one did pass stages as extra parameters, it would have the same effect as
creating a new pipeline with those stages. No idea why someone would do that,
but no compelling reason to stop them.
----------------------------------------------------------------
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]