The data mining algorithm called the Apriori algorithm is used to do market basket analysis. This apriori algorithm systematically identifies itemsets that are bought frequently by using support, confidence and, lift metrics. We set threshold values for support, confidence values according to our requirements. We identify those itemsets are correlated if the support, confidence values of itemsets cross pre-threshold values.
If you want to learn Market basket analysis and other recommendation systems, I recommend registering for these Data Science online courses by Intellipaat.
You can watch this video on Market basket analysis to know how to implement the Apriori algorithm: