What Is Apriori Algorithm?

The name of the commonly used apriori algorithm under the topic of Association Rule Mining in the field of data mining means the deduction acquired by deduction. Let’s get to know this algorithm, which is a step-by-step way to explore a data set and to examine the coexistence rules of the data in the data set.

The most obvious example of the Apriori algorithm is the shopping cart.

alışveriş kartı

As can be seen from the picture above, it is possible to find out  which products are sold and which products are sold together from shopping list or card.

The value of the support value data set is also the threshold value of the algorithm. For example, if a product is sold less than 3 in a data set, we do not need to process this product on the camp or any other process.

Our data set is as follows.

In other words, we will decide on which products are sold and the frequency of use.

The frequency value is how much the relevant element is used in total, or how much a product is sold if we go through our example. As you can see from the table, the total number of shopping is 10, the number of shopping that A product is sold is 8, so we said the frequency of product A to 0.8.

Step 1 of the Apiori Algorithm in this way, now let’s go to stage 2.

Let’s set a support value and reduce our data. If the support value of the purchased products is below 0.3, you can ignore the exchange.


From the table above, we can say that A and B products (from the first line) were sold together in half of the whole shopping. Our support value was 0.3. In other words, the curve above the threshold value has become important information for us. If you have noticed other purchases in the table in the same way we didn’t include any of the purchases below 0.3 because it is below our threshold value, which is not important information for us.

When we go one step further, the above table will be formed and the algorithm will end here because our data set has a value of 0.3 or no other support value.



As a result, the following can be deduced. Shopping in {A, B, C} is the most sold. So, A, B and C are the best-selling products together.

Kaynaklar: Hackerearth , Stonybrook


Leave a Reply

Your email address will not be published. Required fields are marked *