@@ -22,11 +22,11 @@ import org.apache.spark.ml.{Estimator, Model}
2222import org .apache .spark .ml .classification .{LogisticRegression , LogisticRegressionModel }
2323import org .apache .spark .ml .classification .LogisticRegressionSuite .generateLogisticInput
2424import org .apache .spark .ml .evaluation .{BinaryClassificationEvaluator , Evaluator , RegressionEvaluator }
25- import org .apache .spark .ml .linalg .{ DenseMatrix , Vectors }
25+ import org .apache .spark .ml .linalg .Vectors
2626import org .apache .spark .ml .param .ParamMap
2727import org .apache .spark .ml .param .shared .HasInputCol
2828import org .apache .spark .ml .regression .LinearRegression
29- import org .apache .spark .ml .util .DefaultReadWriteTest
29+ import org .apache .spark .ml .util .{ DefaultReadWriteTest , MLTestingUtils }
3030import org .apache .spark .mllib .util .{LinearDataGenerator , MLlibTestSparkContext }
3131import org .apache .spark .sql .Dataset
3232import org .apache .spark .sql .types .StructType
@@ -78,6 +78,10 @@ class TrainValidationSplitSuite
7878 .setTrainRatio(0.5 )
7979 .setSeed(42L )
8080 val cvModel = cv.fit(dataset)
81+
82+ // copied model must have the same paren.
83+ MLTestingUtils .checkCopy(cvModel)
84+
8185 val parent = cvModel.bestModel.parent.asInstanceOf [LinearRegression ]
8286 assert(parent.getRegParam === 0.001 )
8387 assert(parent.getMaxIter === 10 )
0 commit comments