@@ -232,14 +232,21 @@ def fit(self, dataset, params={}):
232232 def copy (self , extra = {}):
233233 """
234234 Creates a copy of this instance with a randomly generated uid
235- and some extra params. This copies the underlying estimator, creates a deep copy of the embedded paramMap, and
236- copies the embedded and extra parameters over.
235+ and some extra params. This copies the underlying estimator,
236+ evaluator, and estimatorParamMap, creates a deep copy of the
237+ embedded paramMap, and copies the embedded and extra parameters
238+ over.
237239 :param extra: Extra parameters to copy to the new instance
238240 :return: Copy of this instance
239241 """
240- paramMap = self .extractParamMap (extra )
241- stages = map (lambda stage : stage .copy (extra ), paramMap [self .stages ])
242- return CrossValidator ().setStages (stages )
242+ newCV = Params .copy (self , extra )
243+ if self .isSet (self .estimator ):
244+ newCV .setEstimator (self .getEstimator ().copy (extra ))
245+ if self .isSet (self .estimatorParamMaps ):
246+ newCV .setEstimatorParamMaps (self .getEstimatorParamMaps ().MAGIC_COPY_TO_BE_IMPLEMENTED (extra )) # TODO
247+ if self .isSet (self .evaluator ):
248+ newCV .setEvaluator (self .getEvaluator ().copy (extra ))
249+ return newCV
243250
244251
245252class CrossValidatorModel (Model ):
0 commit comments