October 2017
Beginner to intermediate
572 pages
26h 1m
English
Perform the following steps to prune redundant rules:
> rules.sorted = sort(rules, by="lift")
> subset.matrix = is.subset(rules.sorted, rules.sorted)
> subset.matrix[lower.tri(subset.matrix, diag=T)] = NA
> redundant = colSums(subset.matrix, na.rm=T) >= 1
> rules.pruned = rules.sorted[!redundant]
> inspect(head(rules.pruned))
Output
lhsrhs support confidence lift
1 {Instant food products,
soda} => {hamburger meat} 0.001220132 0.6315789 18.99565
2 {soda,
popcorn} => {salty snack} 0.001220132 0.6315789 16.69779
3 {flour,
baking powder} => {sugar} 0.001016777 0.5555556 16.40807 4 {ham, processed cheese} => {white bread} 0.001931876 ...Read now
Unlock full access