Apriori Implementation |
Download the following files:
hercules[1]% javac -deprecation apriori.java
Change config.txt and transa.txt to represent the database and criteria to be tested.
Run the programs:
hercules[2]% java apriori
Example
We use the database example from Apriori
Itemset Generation. The minsupp is 40%.
TID | A | B | C | D | E |
T1 | 1 | 1 | 1 | 0 | 0 |
T2 | 1 | 1 | 1 | 1 | 1 |
T3 | 1 | 0 | 1 | 1 | 0 |
T4 | 1 | 0 | 1 | 1 | 1 |
T5 | 1 | 1 | 1 | 1 | 0 |
Transa.txt contains a row for each of the five transactions and
a column for each of the five items.
1 1 1 0 0
1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 |
Config.txt: The value of the last line is ingnored by apriori.java.
5
5 40 5 |
Output:
hercules[71]% java apriori
Algorithm apriori starting now..... Press 'C' to change the default configuration and transaction files
Input configuration: 5 items, 5 transactions, minsup = 40% Frequent 1-itemsets:
Execution time is: 0 seconds.
|
We get the same results as we did earlier when we did the Apriori algorithm by hand.