diff options
author | Wojciech Szymanski <wk.szymanski@gmail.com> | 2016-11-06 07:43:13 -0800 |
---|---|---|
committer | Yanbo Liang <ybliang8@gmail.com> | 2016-11-06 07:43:13 -0800 |
commit | b89d0556dff0520ab35882382242fbfa7d9478eb (patch) | |
tree | 0ecb3c3e4b54333c254cfcdd3af6a0427c6e850f /mllib/src/main | |
parent | 340f09d100cb669bc6795f085aac6fa05630a076 (diff) | |
download | spark-b89d0556dff0520ab35882382242fbfa7d9478eb.tar.gz spark-b89d0556dff0520ab35882382242fbfa7d9478eb.tar.bz2 spark-b89d0556dff0520ab35882382242fbfa7d9478eb.zip |
[SPARK-18210][ML] Pipeline.copy does not create an instance with the same UID
## What changes were proposed in this pull request?
Motivation:
`org.apache.spark.ml.Pipeline.copy(extra: ParamMap)` does not create an instance with the same UID. It does not conform to the method specification from its base class `org.apache.spark.ml.param.Params.copy(extra: ParamMap)`
Solution:
- fix for Pipeline UID
- introduced new tests for `org.apache.spark.ml.Pipeline.copy`
- minor improvements in test for `org.apache.spark.ml.PipelineModel.copy`
## How was this patch tested?
Introduced new unit test: `org.apache.spark.ml.PipelineSuite."Pipeline.copy"`
Improved existing unit test: `org.apache.spark.ml.PipelineSuite."PipelineModel.copy"`
Author: Wojciech Szymanski <wk.szymanski@gmail.com>
Closes #15759 from wojtek-szymanski/SPARK-18210.
Diffstat (limited to 'mllib/src/main')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/ml/Pipeline.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/ml/Pipeline.scala b/mllib/src/main/scala/org/apache/spark/ml/Pipeline.scala index 195a93e086..f406f8c426 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/Pipeline.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/Pipeline.scala @@ -169,7 +169,7 @@ class Pipeline @Since("1.4.0") ( override def copy(extra: ParamMap): Pipeline = { val map = extractParamMap(extra) val newStages = map(stages).map(_.copy(extra)) - new Pipeline().setStages(newStages) + new Pipeline(uid).setStages(newStages) } @Since("1.2.0") |