What good is that? Well…its exactly what we want to see. Apriori Algorithm : Know How to Find Frequent Itemsets Next, we want to hot encode the data and get 1 transaction per row to prepare to run our mlxtend analysis. Now, we are ready to start our market basket analysis. That can be accomplished with the following line of code. We can see an example of these types of invoices with the following. You can use a pre-built library like MLxtend or you can build your own algorithm.īelow, I provide an example of using MLxtend as well as an example of how to roll your own analysis. There are a few approaches that you can take for this type of analysis. In the remainder of this article, I show you how to do this type of analysis using python and pandas. If you have a large amount of transactional data, you should be able to run a market basket analysis with ease.
Market Basket Analysis requires a large amount of transaction data to work well. With these rules, you can then build our recommendation engines for your website, store and salespeople to use when selling products to customers. In the simplest of terms, market basket analysis looks at retail sales data and determines what products are purchased together.