Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20686#discussion_r171761966
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/feature/RFormulaSuite.scala ---
@@ -381,31 +386,31 @@ class RFormulaSuite extends MLTest with
DefaultReadWriteTest {
NumericAttribute.defaultAttr)).toMetadata()
val original = base.select(base.col("id"), base.col("vec").as("vec2",
metadata))
val model = formula.fit(original)
- val result = model.transform(original)
- val attrs = AttributeGroup.fromStructField(result.schema("features"))
+ val expected = Seq(
+ (1, Vectors.dense(0.0, 1.0), Vectors.dense(0.0, 1.0), 1.0),
+ (2, Vectors.dense(1.0, 2.0), Vectors.dense(1.0, 2.0), 2.0)
+ ).toDF("id", "vec2", "features", "label")
+ .select($"id", $"vec2".as("vec2", metadata), $"features", $"label")
--- End diff --
nit: indent
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]