What Is The Difference Between (CARMA) and Apriori?

Image for post
Image for post

You might have heard of the Apriori algorithm, which is mostly used for generating association rules. CARMA, which stands for Continuous Association Rule Mining Algorithm, is another algorithm which can be used for association rule mining (ARM).

In this post, I would be talking mainly about the difference between CARMA and Apriori algorithms and the suitability of using different ARM algorithms for a given problem.

What Is CARMA?

CARMA consists of 2 phases or passes of data which can be summarised as follows:

Phase I: CARMA uses a single pass to construct a list of itemsets (lattice) of all potentially frequent itemsets for every transaction. For each transaction being processed, the user can specify any support threshold. As each transaction is read, the itemset is updated.

Phase II: The second phase determines the precise support of all itemsets and prunes away all infrequent itemsets, and their supersets reduce the time needed and make processing more efficient. Lastly, only frequent association rules are being generated from the updated lattice.

Compared to the Apriori algorithm, CARMA can generate rules with multiple consequents (e.g. Antecedent = {Milk, Bread} and Consequent = {Eggs, Ham}, whereas the former can only create rules with a single consequent.

Image for post
Image for post
Example of a CARMA output with multiple consequents
Image for post
Image for post
Example of an Apriori output with single consequent

It is possible to generate the same rules using the Apriori method. But for a large dataset, the CARMA would require less space and time than using the Apriori algorithm.

Compared to the Apriori algorithm, CARMA uses the rule support instead of antecedent support when generating rules.

Additionally, compared to the Apriori algorithm, CARMA allows the uses to change the support thresholds during execution.

Summary (Difference between CARMA and Apriori algorithm)

  • CARMA is more efficient and requires less computing space and time compared to Apriori. (Due to 2 passes of data)

Suitability of Using Different Algorithms for Association Analysis

When choosing the most appropriate method to conduct association analysis, factors such as the characteristics of the data to be analysed and knowing the strengths and weaknesses of the techniques under consideration plays an important role.

Both CARMA and Apriori algorithms are not designed to handle numerical data. Thus, if the dataset consists of numeric inputs, they must be categorised (binned) first.

Image for post
Image for post
Example of binning numerical inputs. Where Bin 1 = High Salary, Bin 2 = Medium Salary and Bin 3 = Low Salary.

A further distinction between CARMA and Apriori is that CARMA can only handle binary inputs, whereas Apriori can handle data with more than two categories.

Another advantage of CARMA over Apriori is that, if rules with many consequents are desired, then CARMA would be a better option as it can generate association rules with multiple consequents.

Written by

Student, Writer and a Curious learner. Connect with me: https://www.linkedin.com/in/jlzp/ First ebook: https://www.amazon.com/dp/B089QQ5CNR

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store