# Filtering redundant Association rules

After performing association rule mining, (using mlxtend library), I have gotten a pandas dataframe containing all the association rules. This contains too many rules, therefore we must reduce the number.

For an association rule $$R: X \implies Y$$

For any $$Z \subset X$$

If any rule $$R': X - Z \implies Y$$ exists, such that $$confidence(R) \pm \alpha = confidence(R')$$

Then remove $$R$$

I tried to implement that logic directly into python as such

def filter_useless(rules):