Apriori - Association RulesC# Implementation of Apriori Algorithm Using Association RulesDemo. Download the demo.txt transaction file.
![]() ![]()
In data mining, Apriori is a classic algorithm for learning association rules. Apriori is designed to operate on databases containing transactions (for example, collections of items bought by customers, or details of a website frequentation). In this chapter, we will discuss Association Rule (Apriori and Eclat Algorithms) which is an unsupervised Machine Learning Algorithm and mostly used in data mining. Most ML algorithms in DS work.
Run the application. Load the demo.txt file into the application. Change the support level using the slider.DescriptionData mining extracts hidden predictive information from large databases.
It is a powerful new technology with great potential to help companies focus on the most important information in their data warehouses.This tool will generate all combination using Association Rules, confidance and support for each rule. Changing the support level will change the level generate each time.
![]()
First, there is two loops:for (int i = 0; iThese loops are used to compare each pairs of itemsets of a given size together. The first thing that I notice about this Apriori implementation is that it is not efficient because if the itemsets are lexically ordered, then you don't need to compare each itemset with each other. You can stop earlier. But this code does not have this optimization.The second big problem that I see with this code is that the candidates are stored as Strings. It would be much more efficient to store it as an array of Integers. Storing the itemset as String including ',' and spliting them to separate numbers is a very bad design decision, that will waste memory and execution time. For a data mining algorithm, the implementation should be as efficient as possible.
In my opinion, this means that the code that you are looking at has been written by a novice.About your question, the variable 'temp' is used to store a new candidate. Remind that a candidate is the concatenation of two itemsets.
To combine two itemsets, you need to check that they share all items except one. For example, if you have two itemsets ABC and ABD, these two itemsets will generate a new candidates that will be ABCD. But if two itemsets have more than one different item, you should not combine them. That is what the code that you show me is trying to do by.If you want to look at some efficient Apriori implementation, you can check my , I provide some efficient Java implementations. If you want some efficient c implementations, then look at:.
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |