scalaapache-sparkdata-miningapache-spark-mllib

Extract the Lift and Support from Association Rules using SPARK


I'm using the Frequent Pattern Mining algorithm - Association Rules:

import org.apache.spark.mllib.fpm.AssociationRules
import org.apache.spark.mllib.fpm.FPGrowth.FreqItemset

val freqItemsets = sc.parallelize(Seq(
  new FreqItemset(Array("a"), 15L),
  new FreqItemset(Array("b"), 35L),
  new FreqItemset(Array("a", "b"), 12L)
))

val ar = new AssociationRules()
  .setMinConfidence(0.8)
val results = ar.run(freqItemsets)

results.collect().foreach { rule =>
  println("[" + rule.antecedent.mkString(",")
    + "=>"
    + rule.consequent.mkString(",") + "]," + rule.confidence)
}

Is possible to extract the Support and the Lift of the Rule? I'm only getting the confidence.


Solution

  • Currenlty no. There are two JIRA ticket for it.

    See:

    Adding Lift Calculation in Association Rule mining

    Adding Support Calculation in Association Rule mining