srowen commented on a change in pull request #21627: [SPARK-24484][MLLIB]Power
Iteration Clustering is giving incorrect clustering results when there are
mutiple leading eigen values.
URL: https://github.com/apache/spark/pull/21627#discussion_r249524209
##########
File path:
mllib/src/test/scala/org/apache/spark/ml/clustering/PowerIterationClusteringSuite.scala
##########
@@ -169,6 +169,59 @@ class PowerIterationClusteringSuite extends SparkFunSuite
assert(localAssignments === localAssignments2)
}
+ test("Power Iteration failed to converge") {
+ /*
+ Graph:
+ 1
+ /
+ /
+ 0 2 -- 3
+ */
+ val data1 = spark.createDataFrame(Seq(
+ (0, 1),
+ (2, 3)
+ )).toDF("src", "dst")
+
+ val msg1 = intercept[SparkException] {
+ new PowerIterationClustering()
+ .setInitMode("random")
+ .setK(2)
+ .assignClusters(data1)
+ }.getMessage
+ assert(msg1.contains("Power Iteration fail to converge"))
Review comment:
Yeah I'd log a warning and let it proceed. Anything you can assert about the
model here is OK; it may not be possible to test much other than it succeeded
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]