Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/8152#discussion_r37038684
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/feature/StringIndexerSuite.scala ---
@@ -120,4 +108,36 @@ class StringIndexerSuite extends SparkFunSuite with
MLlibTestSparkContext {
val df = sqlContext.range(0L, 10L)
assert(indexerModel.transform(df).eq(df))
}
+
+ test("IndexToString params") {
+ val idxToStr = new IndexToString()
+ ParamsSuite.checkParams(idxToStr)
+ }
+
+ test("IndexToString.transform") {
+ val labels = Array("a", "b", "c")
+ val df0 = sqlContext.createDataFrame(Seq(
+ (0, "a"), (1, "b"), (2, "c"), (0, "a")
+ )).toDF("index", "expected")
+
+ val idxToStr0 = new IndexToString()
+ .setInputCol("index")
+ .setOutputCol("actual")
+ .setLabels(labels)
+ idxToStr0.transform(df0).select("actual",
"expected").collect().foreach {
+ case Row(actual, expected) =>
+ assert(actual === expected)
+ }
+
+ val attr = NominalAttribute.defaultAttr.withValues(labels)
--- End diff --
This is more like a unit test. If we want to check that, we should put
another unit test for `StringIndexer`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]