For a rule A -> B over a list of transactions (sets of items):
support = fraction of transactions containing both A and Bconfidence = support(A ∪ B) / support(A)lift = confidence / support(B)conviction = (1 - support(B)) / (1 - confidence) (return inf when confidence is 1)A and B are sets of items. Implement rule_metrics(transactions, A, B) returning a dict with those four keys.