top of page

Market Basket Analysis based on Frequent Itemset Mining

Updated: Jun 27, 2020

Market Basket Analysis plays an important role in retail organizations for analytical studies and based on that placement of items in the store, highlighting items and targeting advertisements for different kind of customers which eventually improves the customers experience and increases the financial profit for the store person.

“Market Basket Analysis based on Frequent Itemset Mining” project addresses the issues faced by the supermarket and helps customers to make their shopping experience better. We are using a dataset provided from Kaggle which consists of cart purchase history of all Instacart users. The frequent itemset is mined from the market basket database using the efficient K-Apriori algorithm and the then conditional algorithm used for the association rules generation

Market Basket Analysis is one of the information mining strategies concentrating on finding acquiring designs by extricating affiliations or co-events from a store's value-based information. Market Basket Analysis decides the items which are purchased together and to revamp the grocery store format, and furthermore to plan special battles with the end goal that items' buy can be improved. Henceforth, Market customer practices should be analyzed, which should be possible through various information mining methods.

Block Diagram

Software Requirements • Python • Pandas Library + Dask Library in Python • HTML • Windows System (7/8/10)

Algorithm Steps

Reading and Merging the Dataset 1. Reading the dataset (provided from Kaggle) 2. Merging user_id, order_id, and product_id table

Average Cart Product Count 3. Count of product_ids bought till now for each user for each product_id 4. Sort based on Most Bought Item for each user 5. Temp5 – Contains total products bought by each user 6. Temp6 – Contains total times user went to the supermarket 7. Using Temp5 and Temp6 – We have calculated avg number of items bought in each visit by each user

Prediction of Cart Products for each User 8. We are predicting – the cart of each user using the K Apriori Algorithm o Select top x (which calculated in step 7) product_ids from Step 4 9. Merging Step 8 table with Products dataset – Here we will get actual names of the product user is going to buy (predicted)

Prediction of Suggested Items based on Predicted Cart 10. Counting aisle_ids – To find out maximum occurring aisle_ids 11. Counting of Product_ids for given aisle_id 12. We will choose the top 4 aisle_ids from step 10 and based on that we will choose the top 2 product ids 13. Now, we have a total 8 suggested product_ids 14. Remove the product_ids which are already present in the cart from step 13 15. Merge the suggested cart table with products table for getting the names 16. We have predicted cart and suggested cart ready for existing users.

For more details, Reach out to us. You can fill the form available on the website ( or directly call/WhatsApp us on +91-9545954177.


Technical Team Member

104 views0 comments


bottom of page