Louiszr commented on a change in pull request #29445:
URL: https://github.com/apache/spark/pull/29445#discussion_r474339628
##########
File path: python/pyspark/ml/tuning.py
##########
@@ -536,7 +536,7 @@ def copy(self, extra=None):
bestModel = self.bestModel.copy(extra)
avgMetrics = self.avgMetrics
subModels = self.subModels
- return CrossValidatorModel(bestModel, avgMetrics, subModels)
+ return self._copyValues(CrossValidatorModel(bestModel, avgMetrics,
subModels), extra=extra)
Review comment:
`avgMetrics` should be shallow copied, as tested in
https://github.com/Louiszr/spark/blob/8ae74d000ac48d6e293feb4bc3dac31088bf6c6c/python/pyspark/ml/tests/test_tuning.py#L124-L129
I think `Params.copy` will shallow copy the `CrossValidatorModel` object and
thus only copy the reference to `avgMetrics`
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]