Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

Creating subsets of the rules

As we did before, we can look at some of the subsets by parsing the left or right side.

For example, we might be interested in seeing what items yielded purchasing chocolate things:

  • Subset the rules set using the %pin% operator (partial match), and look for any transactions where chocolate appears in the right-hand side:

        purchased.this <- "Chocolate"        lhs.rules <- subset(rules1, subset = rhs %pin%           purchased.this)
  • Printing lhs.rules shows that there are 487 of them:

        print(lhs.rules) > set of 487 rules
  • Sort them by lift, inspect them, and plot the first 15 as a graph:

lhs.rules <- sort(lhs.rules, by = "lift")inspect(head(sort(lhs.rules, by = "lift"))) > lhs rhs support confidence lift > 1 {CakeTowelSpots} ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content