Skip to content

Commit b9e3e47

Browse files
committed
update transform
1 parent 13eb37c commit b9e3e47

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

mllib/src/main/scala/org/apache/spark/ml/fpm/FPGrowth.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,8 @@ class FPGrowthModel private[ml] (
269269
val predictUDF = udf((items: Seq[_]) => {
270270
if (items != null) {
271271
val itemset = items.toSet
272-
brRules.value.flatMap(rule =>
273-
if (items != null && rule._1.forall(item => itemset.contains(item))) {
274-
rule._2.filter(item => !itemset.contains(item))
275-
} else {
276-
Seq.empty
277-
}).distinct
272+
brRules.value.filter(_._1.forall(itemset.contains))
273+
.flatMap(_._2.filter(!itemset.contains(_))).distinct
278274
} else {
279275
Seq.empty
280276
}}, dt)

0 commit comments

Comments
 (0)