3

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)
}

My question is:

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

Many thanks!

João_testeSW
  • 99
  • 1
  • 12

1 Answers1

1

Currenlty no. There are two JIRA ticket for it.

See:

Adding Lift Calculation in Association Rule mining

Adding Support Calculation in Association Rule mining

Umberto Griffo
  • 931
  • 6
  • 13
  • Hi @Umberto, many thanks for your response. :) I'm not understanding very well how can I apply this on Spark. Is this an API? – João_testeSW Sep 30 '16 at 10:17
  • Hi @João_testeSW you are welcome :). When they are ready you can use It with the methods **rule.support** and **rule.lift** – Umberto Griffo Sep 30 '16 at 13:11