This pogram is implementation of association rule mining algorithm Apriori written in Java.
Source code of this is in Apriori.java file.
When you will run Apriori.Java file, one file named Rules will be generated, this file conatin all rules.
About Source code Apriori is the only one file whihch do all the operations and they are below
Eagle view of my source code is below:
Run (Apriori.Java) file
--> Ask user input data file and then stored into ArrayList, then this pogram ask user to input minimum support rate and condifence ate value.
Step 1:- generating K-frequent item set
--> First unique word set is geneared.
--> "candidate_itemset()" function is called this will generate candidate item set upto 2 candidate item itemset.
--> "find_word_set_from_data_set()" function is called which will generate frequent item set from previous candidate itemset. Here in this function K is passed as parameter which in turn generate k-frequent item set. IN this funation pruning is done i.e it will remove those item whose rate is less than minimum support and this is retuned back to function and stored into HashMap.
--> Now from here "candidate_itemset_general()" function is called which will generate candidate item itemset starting from three upto K i.e. upto last stopping condition is met.
--> "find_word_set_from_data_set()" function will generate upto n frequent item set. when stopping condition is met it will stop.
This all frequent item set output is stored into one HashMap and also in 1 external file.(hashmapoutput88) namely
So upto this combination step is over i.e. generating K-frequent item set with.
Now Step 2:- Permutation.
Now from all K- frequent itemset, i have taken every frequent item set individually and then it passed to "permutation()" function which will generate all possible subset of all item set, and stored into another external file.
After this for each subset i have calculated confidence and for those subset who's confidence value > user confidence value, for that rules is genrated i.e pruning is done at this step.
This rule is stored into External file name Rule.
STRUCTURE OF MY CODE
Input:- Data set, support_rate, Confidence_value this all value is given by user.
processing:- 1) Build First Itemset 2) Generate 1 Frequent item set 3) Build K-frequent Itemset 4) Prune K-frequent itemset 5) generate all possible subset from frequent Itemset 6) Generate Rule 7) Calculate Confidence Rate 8) Prune of rules 8) print and store into external text file.
Output:- Write Rules in External File.
HOW TO RUN CODE
- Run Apriori.Java file this will generte 3 files, first two are of no use when you concentrate on Output, they are file which conatain all possible subset, and second file contains All k- frequent itemset.
Rule File contain All rules, which is final output of program and output of this assignment.
One more thing if you re-run the code again make sure you delete all files which is generated by code while running.