Icon

Finding Association Rules for Market Basket Analysis

There has been no title set for this workflow's metadata.

This workflow builds a recommendation engine for market basket analysis using the Borgelt version of the Apriori algorithm. A market basket analysis aims to analyze whether combinations of products frequently co-occur in transactions.

URL: Market Basket Analysis and Recommendation Engines https://www.knime.org/blog/market-basket-analysis-and-recommendation-engines
URL: Recommendation Engines https://youtu.be/z8jbAm38yXs

Annotations and comments
  • Finding Association Rules for Market Basket Analysis The aim of a market basket analysis is to analyze whether there are combinations of products that frequently co-occur in transactions. This workflow illustrates how to build a recommendation engine for market basket analysis.
  • Task Build a recommendation engine for market basket analysis using the Borgelt version of the Apriori algorithm.
  • Data Reading 2 files: Transactions Products info Transactions are in the shape of concatenated Strings. The Association Rule learner node requires a collection of items as input. The Cell Splitter node here transforms string rows into item collections. Another way of getting item collections is to use the aggregation method "List" in a GroupBy node. Both files are located in TheData/Baskets
  • Build Association Rules The Association Rule Learner (Borgelt) node implements the "A priori" algorithm to find the association rules. min. set size = 1 min rule confidence = 10% min support (in %) is controlled by the Double Configuration node
  • Data Processing Create RuleID from RowID Ungroup antecedent item collection Join prices and product names to antecedent items Join consequent item to product name Add price to consequent item Calculate price stats and rule revenue
  • Save the Model The model here is a table of rules. We write the association rules to a file.
  • Min. set size = 1 min rule confidence = 10% min support is controlled by Double Input Quickform node in %
  • Transform string rows into item collections
  • Min support = 2.5
  • Price sum, list of products rule support, rule confidence, etc ... by set id
  • Add prices and product names to antecedents
  • Add price and product name to consequent
  • Calculating revenues following recommendation as price(consequent) * support(rule)
  • Set id
  • Sets
  • Convert Item ID to String
  • Reading "transactions.table": 1 row = 1 transaction product IDs bought for each transaction
  • Reading "items.table": ID, price, productName
  • Write association rules to a file

Nodes

Extensions

Links