Icon

Finding Association Rules for Market Basket Analysis

Market Basket Analysis: Building Association Rules

This workflow builds a recommandation engine for market basket analysis using the Borgelt version of the Apriori algorithm.

URL: Market Basket Analysis and Recommandation Engines https://www.knime.org/knime-applications/market-basket-analysis-and-recommendation-engines

BLOG: Market Basket Analysis and Recommandation Engines https://www.knime.org/blog/market-basket-analysis-and-recommendation-engines

Market Basket Analysis: Build Association RulesThe 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 arecommendation engine for market basket analysis. Task Build a recommendation engine for market basket analysis using the Borgelt version of the Apriori algorithm.A use case is described at URL: https://www.knime.org/knime-applications/market-basket-analysis-and-recommendation-enginesThe blog is available at the following URL: https://www.knime.org/blog/market-basket-analysis-and-recommendation-enginesCheck how to work with collections at the following URL: https://www.knime.org/blog/collection-cookbook Data Reading2 files: - Transactions - Products info Transactions are in the shape of concatenated Strings. The AssociationRule learner node requires a collection of items as input. The CellSplitter node here transforms string rows into item collections. Anotherway of getting item collections is to use the aggregation method, List,in a GroupBy node.Both files are located in TheData/BasketsFor more info, check the blog post https://www.knime.org/blog/collection-cookbook Build Association RulesThe Association Rule Learner(Borgelt) node implements the "Apriori" algorithm to find theassociation rules. - min. set size = 1 - min rule confidence = 10% - min support (in %) is controlledby the Double Configuration node Save the ModelThe model here is a table ofrules. We write the associationrules to a file. Data Processing - Create RuleID from RowID - Ungroup antecedent itemcollection - Join prices and product namesto antecedent items - Join consequent item toproduct name - Add price to consequent item - Calculate price stats and rulerevenue Transactions1 row = 1 transactionproduct IDs bought for each transaction Items:ID, price, productName Min. set size = 1 min rule confidence = 10%min support is controlled by Double Input Quickform node in %convertItem ID toStringTransform string rowsinto item collectionMin support = 2.5Write association rulesto a fileReadingtransactions.tableReadingitems.tableAssociation RuleLearner (Borgelt) Ungroup collections Number To String Cell Splitter DoubleConfiguration Table Writer Table Reader Table Reader Market Basket Analysis: Build Association RulesThe 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 arecommendation engine for market basket analysis. Task Build a recommendation engine for market basket analysis using the Borgelt version of the Apriori algorithm.A use case is described at URL: https://www.knime.org/knime-applications/market-basket-analysis-and-recommendation-enginesThe blog is available at the following URL: https://www.knime.org/blog/market-basket-analysis-and-recommendation-enginesCheck how to work with collections at the following URL: https://www.knime.org/blog/collection-cookbook Data Reading2 files: - Transactions - Products info Transactions are in the shape of concatenated Strings. The AssociationRule learner node requires a collection of items as input. The CellSplitter node here transforms string rows into item collections. Anotherway of getting item collections is to use the aggregation method, List,in a GroupBy node.Both files are located in TheData/BasketsFor more info, check the blog post https://www.knime.org/blog/collection-cookbook Build Association RulesThe Association Rule Learner(Borgelt) node implements the "Apriori" algorithm to find theassociation rules. - min. set size = 1 - min rule confidence = 10% - min support (in %) is controlledby the Double Configuration node Save the ModelThe model here is a table ofrules. We write the associationrules to a file. Data Processing - Create RuleID from RowID - Ungroup antecedent itemcollection - Join prices and product namesto antecedent items - Join consequent item toproduct name - Add price to consequent item - Calculate price stats and rulerevenue Transactions1 row = 1 transactionproduct IDs bought for each transaction Items:ID, price, productName Min. set size = 1 min rule confidence = 10%min support is controlled by Double Input Quickform node in %convertItem ID toStringTransform string rowsinto item collectionMin support = 2.5Write association rulesto a fileReadingtransactions.tableReadingitems.tableAssociation RuleLearner (Borgelt) Ungroup collections Number To String Cell Splitter DoubleConfiguration Table Writer Table Reader Table Reader

Nodes

Extensions

Links