Skip to content

Commit 60efd05

Browse files
committed
add support for association rule
1 parent baa3e63 commit 60efd05

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mllib/src/main/scala/org/apache/spark/mllib/fpm/AssociationRules.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ object AssociationRules {
120120
@Since("1.5.0")
121121
def confidence: Double = freqUnion.toDouble / freqAntecedent
122122

123+
/**
124+
* Returns the support of the rule. Current implementation would return the number of
125+
* co-occurrence of antecedent and consequent.
126+
*/
127+
@Since("2.1.0")
128+
def support: Double = freqUnion.toDouble
129+
123130
require(antecedent.toSet.intersect(consequent.toSet).isEmpty, {
124131
val sharedItems = antecedent.toSet.intersect(consequent.toSet)
125132
s"A valid association rule must have disjoint antecedent and " +

0 commit comments

Comments
 (0)