February 2018
Intermediate to advanced
378 pages
10h 14m
English
What will follow is a simplified version of a code that can be found in supplementary materials. We will skip some of the less important parts here.
The main method, which returns association rules with the given support and confidence, is as follows:
public func associationRules(minSupport: Double, minConfidence: Double) -> [Rule] { var rules = [Rule]() let frequent = frequentItemSets(minSupport: minSupport) for itemSet in frequent { for (ifPart, thenPart) in nonOverlappingSubsetPairs(itemSet) { if confidence(ifPart, thenPart) >= minConfidence { let rule = Rule(ifPart: convertIndexesToItems(ifPart), thenPart: convertIndexesToItems(thenPart)) rules.append(rule) } } } return rules } func nonOverlappingSubsetPairs(_ ...Read now
Unlock full access