Apriori Algorithm

Table of contents

Automate your business at $5/day with Engati

REQUEST A DEMO
Switch to Engati: Smarter choice for WhatsApp Campaigns 🚀
TRY NOW
Apriori Algorithm

What is Apriori Algorithm?

Apriori algorithm is an influential algorithm that is generally used in the field of data mining & association rule learning. It is used to identify frequent itemsets in a dataset & generate an association based rule based on the itemsets.

Imagine you have a database about the items a customer purchases from the store. The Apriori algorithm helps to uncover interesting relationships & patterns in this data. It does that by finding the sets of items that occur together, frequently.

For e.g. the algorithm would discover that when a customer buys bread, they often end up buying butter & eggs as well. This indicates a strong association between these items. These associations help businesses to make decisions to improve sales, customer satisfaction, etc.

Apriori Algorithm
Source: DWgeek

What are the steps of Apriori Algorithm in data mining?

The following are the main steps of the apriori algorithm in data mining:

  1. Set the minimum support threshold - min frequency required for an itemset to be "frequent".
  2. Identify frequent individual items - count the occurence of each individual item.
  3. Generate candidate itemsets of size 2 - create pairs of frequent items discovered.
  4. Prune infrequent itemsets - eliminate itemsets that do no meet the threshold levels.
  5. Generate itemsets of larger sizes - combine the frequent itemsets of size 3,4, and so on.
  6. Repeat the pruning process - keep eliminating the itemsets that do not meet the threshold levels.
  7. Iterate till no more frequent itemsets can be generated.
  8. Generate association rules that express the relationship between them - calculate measures to evaluate the strength & significance of these rules.

3x your revenue with Chatbots and Live Chat
Schedule a demo

What are the advantages of Apriori Algorithm in data mining?

Advantages of April algorithm

After the steps of Apriori algorithm in data mining, it's advantages are as follows:

  1. Simplicity & ease of implementation
  2. The rules are easy to human-readable * interpretable
  3. Works well on unlabelled data
  4. Flexibility & customisability
  5. Extensions for multiple use cases can be created easily
  6. The algorithm is widely used & studied

What are the disadvantages of Apriori Algorithm in data mining?

Following are the disadvantages of the apriori algorithm in data mining:

  1. Computational complexity
  2. Time & space overhead
  3. Difficulty handling sparse data
  4. Limited discovery of complex patterns
  5. Higher memory usage
  6. Bias of minimum support threshold
  7. Inability to handle numeric data
  8. Lack of incorporation of context

How can we improve the Apriori Algorithm's efficiency?

Here are some of the methods how to improve efficiency of apriori algorithm -

  1. Hash-Based Technique: This method uses a hash-based structure called a hash table for generating the k-itemsets and their corresponding count. It uses a hash function for generating the table.
  2. Transaction Reduction: This method reduces the number of transactions scanned in iterations. The transactions which do not contain frequent items are marked or removed.
  3. Partitioning: This method requires only two database scans to mine the frequent itemsets. It says that for any itemset to be potentially frequent in the database, it should be frequent in at least one of the partitions of the database.
  4. Sampling: This method picks a random sample S from Database D and then searches for frequent itemset in S. It may be possible to lose a global frequent itemset. This can be reduced by lowering the min_sup.
  5. Dynamic Itemset Counting: This technique can add new candidate itemsets at any marked start point of the database during the scanning of the database.

What are the components of the Apriori algorithm? 

There are three major components of the Apriori algorithm in data mining which are as follows. 

  1. Support
  2. Confidence
  3. Lift

 

For example, you have 5000 customer transactions in a Zara Store. You have to calculate the Support, Confidence, and Lift for two products, and you may say Men's Wear and Women Wears.

Out of 5000 transactions, 300 contain Men's Wear, whereas 700 contain women's wear, and these 700 transactions include 250 transactions of both men's & women's wear.

 

1. Support

Support denotes the average popularity of any product or data item in the data set. We need to divide the total number of transactions containing that product by the total number of transactions. 

 Support (Men's wear)= (transactions relating MW) / (total transaction)

= 300/5000

= 16.67 %

 

2. Confidence

Confidence is the sum average of transactions/data items present in pairs/combinations in the universal dataset. To find out confidence, we divide the number of transactions that comprise both men's & women's wear by the total number of transactions. 

Hence,

Confidence = (Transactions with men's & women's wear) / (total transaction)

= 250/5000

= 5%

 

3. Lift

It helps find out the ratio of the sales of women's wear when you sell men's wear. The mathematical equation of lift is mentioned below.

Lift = (Confidence ( Men's wear- women's wear)/ (Support (men's wear)

= 20/18

= 1.11 

 

What are the applications of Apriori Algorithm in data mining? 

Apriori Algorithm has picked up a pace in recent years and is used in different industries for data mining and handling. 

Some fields where Apriori is used:

1. Medical

Hospitals are generally trashed with data every day and need to retrieve a lot of past data for existing patience. Apriori algorithm help hospitals to manage the database of patients without jinxing it with other patients. 

2. Education

The educational institute can use the Apriori algorithm to store and monitor students' data like age, gender, traits, characteristics, parent's details, etc. 

3. Forestry

On the same line as the education and medical industry, forestry can also use the Apriori algorithm to store, analyze and manage details of every flora and fauna of the given territory. 

4. New Tech Firms

Tech firms use the Apriori algorithm to maintain the record of various items of products that are purchased by various customers for recommender systems. 

5. Mobile Commerce

Big data can help mobile e-commerce companies to deliver an easy, convenient and personalized shopping experience. With the Apriori algorithm, the real-time product recommendation accuracy increases, which creates an excellent customer experience and increases sales for the company.

Close Icon
Request a Demo!
Get started on Engati with the help of a personalised demo.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
*only for sharing demo link on WhatsApp
Thanks for the information.
We will be shortly getting in touch with you.
Oops! something went wrong!
For any query reach out to us on contact@engati.com
Close Icon
Congratulations! Your demo is recorded.

Select an option on how Engati can help you.

I am looking for a conversational AI engagement solution for the web and other channels.

I would like for a conversational AI engagement solution for WhatsApp as the primary channel

I am an e-commerce store with Shopify. I am looking for a conversational AI engagement solution for my business

I am looking to partner with Engati to build conversational AI solutions for other businesses

continue
Finish
Close Icon
You're a step away from building your Al chatbot

How many customers do you expect to engage in a month?

Less Than 2000

2000-5000

More than 5000

Finish
Close Icon
Thanks for the information.

We will be shortly getting in touch with you.

Close Icon

Contact Us

Please fill in your details and we will contact you shortly.

This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
This is some text inside of a div block.
Thanks for the information.
We will be shortly getting in touch with you.
Oops! Looks like there is a problem.
Never mind, drop us a mail at contact@engati.com