Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/21081#discussion_r181840894
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/clustering/KMeansSuite.scala ---
@@ -194,6 +195,34 @@ class KMeansSuite extends SparkFunSuite with
MLlibTestSparkContext with DefaultR
assert(e.getCause.getMessage.contains("Cosine distance is not
defined"))
}
+ test("KMean with Array input") {
+ val featuresColName = "array_model_features"
+
+ val arrayUDF = udf { (features: Vector) =>
+ features.toArray
+ }
+ val newdataset = dataset.withColumn(featuresColName,
arrayUDF(col("features")) )
--- End diff --
nit: You could drop the original column as well just to make extra sure
that it's not being accidentally used.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]