code: def test_copy(self):
      dataset = self.spark.createDataFrame(
          [(10, 10.0), (50, 50.0), (100, 100.0), (500, 500.0)] * 10,
          ["feature", "label"],
      )
  
      iee = InducedErrorEstimator()
      evaluator = RegressionEvaluator(metricName="rmse")
  
      grid = (
          ParamGridBuilder()
          .addGrid(iee.inducedError, [100.0, 0.0, 10000.0])
          .build()
      )
      cv = CrossValidator(
          estimator=iee,
          estimatorParamMaps=grid,
          evaluator=evaluator,
          numFolds=2,
      )
      cvCopied = cv.copy()
      for param in [
          lambda x: x.getEstimator().uid,
          # SPARK-32092: CrossValidator.copy() needs to copy all existing params
          lambda x: x.getNumFolds(),
          lambda x: x.getFoldCol(),
          lambda x: x.getParallelism(),
          lambda x: x.getSeed(),
      ]:
          self.assertEqual(param(cv), param(cvCopied))
  
      cvModel = cv.fit(dataset)
      cvModelCopied = cvModel.copy()
      for index in range(len(cvModel.avgMetrics)):
          self.assertTrue(
              abs(
                  cvModel.avgMetrics[index]
                  - cvModelCopied.avgMetrics[index]
              )
              < 0.0001
          )
      self.assertTrue(
          np.allclose(cvModel.stdMetrics, cvModelCopied.stdMetrics)
      )
      # SPARK-32092: CrossValidatorModel.copy() needs to copy all existing params
      for param in [
          lambda x: x.getNumFolds(),
          lambda x: x.getFoldCol(),
          lambda x: x.getSeed(),
      ]:
          self.assertEqual(param(cvModel), param(cvModelCopied))
  
      cvModel.avgMetrics[0] = "foo"
      self.assertNotEqual(
          cvModelCopied.avgMetrics[0],
          "foo",
          "Changing the original avgMetrics should not affect the copied model",
      )
      cvModel.stdMetrics[0] = "foo"
      self.assertNotEqual(
          cvModelCopied.stdMetrics[0],
          "foo",
          "Changing the original stdMetrics should not affect the copied model",
      )
  
imports: import tempfile
  import unittest
  import sys
  import numpy
  from pyspark.ml.param import Param, Params
  from pyspark.ml.tuning import ParamGridBuilder
  from pyspark.sql import SparkSession
  from pyspark.sql.functions import rand
  from pyspark.testing.connectutils import should_test_connect, connect_requirement_message
label_desc: Use image node_id 2 for calling the CrossValidatorTestsMixin obj's underlying member method code with example usage: obj.test_copy() without return types