Github user hhbyyh commented on a diff in the pull request:
https://github.com/apache/spark/pull/17336#discussion_r106721298
--- Diff: mllib/src/test/scala/org/apache/spark/ml/fpm/FPGrowthSuite.scala
---
@@ -95,28 +125,17 @@ class FPGrowthSuite extends SparkFunSuite with
MLlibTestSparkContext with Defaul
test("read/write") {
def checkModelData(model: FPGrowthModel, model2: FPGrowthModel): Unit
= {
- assert(model.freqItemsets.sort("items").collect() ===
- model2.freqItemsets.sort("items").collect())
+ assert(model.freqItemsets.collect().toSet.equals(
+ model2.freqItemsets.collect().toSet))
+ assert(model.associationRules.collect().toSet.equals(
+ model2.associationRules.collect().toSet))
+
assert(model.setMinConfidence(0.9).associationRules.collect().toSet.equals(
+ model2.setMinConfidence(0.9).associationRules.collect().toSet))
}
val fPGrowth = new FPGrowth()
testEstimatorAndModelReadWrite(fPGrowth, dataset,
FPGrowthSuite.allParamSettings,
FPGrowthSuite.allParamSettings, checkModelData)
}
-
- test("FPGrowth prediction should not contain duplicates") {
- // This should generate rule 1 -> 3, 2 -> 3
- val dataset = spark.createDataFrame(Seq(
- Array("1", "3"),
- Array("2", "3")
- ).map(Tuple1(_))).toDF("features")
- val model = new FPGrowth().fit(dataset)
-
- val prediction = model.transform(
- spark.createDataFrame(Seq(Tuple1(Array("1", "2")))).toDF("features")
- ).first().getAs[Seq[String]]("prediction")
-
- assert(prediction === Seq("3"))
- }
--- End diff --
Didn't change this one, just move it to keep parameter and save/load check
at the bottom.
---
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]