Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/6997#discussion_r33199970
--- Diff:
mllib/src/test/scala/org/apache/spark/mllib/fpm/FPGrowthSuite.scala ---
@@ -61,17 +63,49 @@ class FPGrowthSuite extends SparkFunSuite with
MLlibTestSparkContext {
val model2 = fpg
.setMinSupport(0.3)
.setNumPartitions(4)
+ .setMineSequences(false)
.run(rdd)
assert(model2.freqItemsets.count() === 54)
val model1 = fpg
.setMinSupport(0.1)
.setNumPartitions(8)
+ .setMineSequences(false)
.run(rdd)
assert(model1.freqItemsets.count() === 625)
}
- test("FP-Growth using Int type") {
+ test("FP-Growth frequent item-sequences using String type"){
+ val transactions = Seq(
+ "r z h k p",
+ "z y x w v u t s",
+ "s x o n r",
+ "x z y m t s q e",
+ "z",
+ "x z y r q t p")
+ .map(_.split(" "))
+ val rdd = sc.parallelize(transactions, 2).cache()
+
+ val fpg = new FPGrowth()
+
+ val model1 = fpg
+ .setMinSupport(0.5)
+ .setNumPartitions(2)
+ .setMineSequences(true)
+ .run(rdd)
+
+ val expected = Set(
+ (Set("r"), 3L), (Set("s"), 3L), (Set("t"), 3L), (Set("x"), 4L),
(Set("y"), 3L),
--- End diff --
Should use `Seq` rather than `Set` to test sequences.
---
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]