diff options
author | Ilya Matiach <ilmat@microsoft.com> | 2016-12-29 13:25:49 -0800 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2016-12-29 13:25:49 -0800 |
commit | 87bc4112c5d766839aaa3876e19dae3a67108265 (patch) | |
tree | 2e382f61b32460c24a2443242327ef46e262883e /mllib/src/test | |
parent | 752d9eeb9bff7934a0645ffd8059cde42da8eeef (diff) | |
download | spark-87bc4112c5d766839aaa3876e19dae3a67108265.tar.gz spark-87bc4112c5d766839aaa3876e19dae3a67108265.tar.bz2 spark-87bc4112c5d766839aaa3876e19dae3a67108265.zip |
[SPARK-18698][ML] Adding public constructor that takes uid for IndexToString
## What changes were proposed in this pull request?
Based on SPARK-18698, this adds a public constructor that takes a UID for IndexToString. Other transforms have similar constructors.
## How was this patch tested?
A unit test was added to verify the new functionality.
Author: Ilya Matiach <ilmat@microsoft.com>
Closes #16436 from imatiach-msft/ilmat/fix-indextostring.
Diffstat (limited to 'mllib/src/test')
-rw-r--r-- | mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala b/mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala index a6bbb944a1..2d0e63c9d6 100644 --- a/mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala +++ b/mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala @@ -20,7 +20,7 @@ package org.apache.spark.ml.feature import org.apache.spark.{SparkException, SparkFunSuite} import org.apache.spark.ml.attribute.{Attribute, NominalAttribute} import org.apache.spark.ml.param.ParamsSuite -import org.apache.spark.ml.util.{DefaultReadWriteTest, MLTestingUtils} +import org.apache.spark.ml.util.{DefaultReadWriteTest, Identifiable, MLTestingUtils} import org.apache.spark.mllib.util.MLlibTestSparkContext import org.apache.spark.sql.Row import org.apache.spark.sql.functions.col @@ -219,6 +219,12 @@ class StringIndexerSuite testDefaultReadWrite(t) } + test("SPARK 18698: construct IndexToString with custom uid") { + val uid = "customUID" + val t = new IndexToString(uid) + assert(t.uid == uid) + } + test("StringIndexer metadata") { val data = Seq((0, "a"), (1, "b"), (2, "c"), (3, "a"), (4, "a"), (5, "c")) val df = data.toDF("id", "label") |