Calculating total coverage of multiple rules in Apriori

Hello all,

I am using Apriori to generate rules for the mushroom dataset and I was trying to figure out if there was an easy way to calculate the total coverage of a certain set of rules. I do not want the individual coverage of each rule, since that is easily available, but the total coverage of the top rules I choose. The end state goal is to answer the question: How many more rules does it take to cover an additional ___% of the population.

Right now I am generating the rules, then filtering the dataset based on those rules(shown below), then counting the number of returns, dividing that by the total number of records. Very cumbersome and time consuming. Any help would be appreciated.

posion.filter <- mushrooms.df %>% filter(mushrooms.df$gill.color=='b' |
                                           mushrooms.df$ring.type=='l' | 
                                           mushrooms.df$odor =='f'| 
                                           (mushrooms.df$cap.color=='e' & mushrooms.df$bruises. =='f'))

summary(posion.filter$class)

ediable.filter <- mushrooms.df %>% filter( mushrooms.df$odor == 'n' |
  (mushrooms.df$bruises.=='t'& mushrooms.df$habitat == 'd') | 
(mushrooms.df$gill.size=='b'& mushrooms.df$spore.print.color == 'k') | 
(mushrooms.df$gill.size=='b'& mushrooms.df$spore.print.color == 'n') |
  (mushrooms.df$stalk.surface.below.ring=='s'& mushrooms.df$population == 'y'))

summary(ediable.filter$class)

-Wes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.