fun leverageForRule( premise: AprioriItemSet?, consequence: AprioriItemSet, premiseCount: Int, consequenceCount: Int ): Double { val coverageForItemSet = consequence.m_counter as Double / m_totalTransactions as Double val expectedCoverageIfIndependent = premiseCount.toDouble() / m_totalTransactions as Double * (consequenceCount.toDouble() / m_totalTransactions as Double) return coverageForItemSet - expectedCoverageIfIndependent }
Outputs the leverage for a rule . Leverage is defined as : < br > prob ( premise & consequence ) - ( prob ( premise ) * prob ( consequence ) )