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

Running the apriori algorithm on the clusters

Circling back to the apriori algorithm, we can use the predicted clusters that were generated instead of lastword, in order to develop some rules:

  • We will use the coerce to dataframe method to generate the transaction file as previously generated

  • Create a rules_clust object, which builds association rules based upon the itemset of clusters {1,2,3,4,5}

  • Inspect some of the generated rules by lift:

        library(arules)        colnames(kw_with_cluster2_score)           kable(head(kw_with_cluster2_score[,c(1,13)],5))        tmp <-            data.frame(kw_with_cluster2_score[,1],        kw_with_cluster2_score[,13])        names(tmp) [1] <- "TransactionID"         names(tmp) [2] <- "Items"        tmp <- unique(tmp) trans4 <- as(split(tmp[,2], tmp[,1]), "transactions") ...
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