I want to extract association rules for a set of transaction with following code Spark-Scala:
val fpg = new FPGrowth().setMinSupport(minSupport).setNumPartitions(10)
val model = fpg.run(transactions)
model.generateAssociationRules(minConfidence).collect()
however the number of products are more than 10K so extracting the rules for all combination is computationally expressive and also I do not need them all. So I want to extract only pair wise:
Product 1 ==> Product 2
Product 1 ==> Product 3
Product 3 ==> Product 1
and I do not care about other combination such as:
[Product 1] ==> [Product 2, Product 3]
[Product 3,Product 1] ==> Product 2
Is there any way to do that?
Thanks, Amir