Hi Setya,
Welcome to the forum.
I assume that you are using the
MainTestAllAssociationRules_FPGrowth_version test file.
To sort the result, you could add this code to the class
RulesAgrawal.java in the package
ca.pfv.spmf.associationrules.agrawal_FPGrowth_version:
public void sortByConfidence(){
Collections.sort(rules, new Comparator<RuleAgrawal>() {
public int compare(RuleAgrawal r1, RuleAgrawal r2) {
return (int)((r2.getConfidence() - r1.getConfidence() ) * Integer.MAX_VALUE);
}
});
}
Then, you can call this method to sort the result by confidence in the test file :
....
// STEP 2: Generating all rules from the set of frequent itemsets (based on Agrawal & Srikant, 94)
double minconf = 0.60;
AlgoAgrawalFaster94_FPGrowth_version algoAgrawal = new AlgoAgrawalFaster94_FPGrowth_version(minconf);
RulesAgrawal rules = algoAgrawal.runAlgorithm(patterns);
rules.sortByConfidence();
rules.printRules(database.size());
...
Hope this helps,
Philippe
Edited 1 time(s). Last edit at 07/04/2012 04:23AM by webmasterphilfv.