From 6685c65d66370982f4a2338bf1bf0aca8692b7cd Mon Sep 17 00:00:00 2001 From: gadelrab Date: Wed, 6 Jul 2016 17:05:31 +0200 Subject: [PATCH] split the method from rules to transactions to allow integerating with Dang --- .../frequentrulesminning/ExceptionMining.java | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/mpii/frequentrulesminning/ExceptionMining.java b/src/main/java/de/mpii/frequentrulesminning/ExceptionMining.java index 4523638..ce48368 100644 --- a/src/main/java/de/mpii/frequentrulesminning/ExceptionMining.java +++ b/src/main/java/de/mpii/frequentrulesminning/ExceptionMining.java @@ -158,19 +158,50 @@ public List mineExceptionsAsFrequentSetMining(AssocRuleWithExcep return patternsFlatItems; } + public List mineExceptionsAsSetManipulation(AssocRuleWithExceptions rule) throws IOException { // Get negative transactions and remove the body items Set negativeTransactions = getNegativeTransactions(rule); - Collection filteredNegTrans=removeBodyItemsFromTransactions(rule, negativeTransactions); + // Get positive transactions and remove the body items Set PositiveTransactions = getPositiveTransactions(rule); - Collection filteredPosTrans=removeBodyItemsFromTransactions(rule, PositiveTransactions); + + + + return mineExceptionsAsSetManipulation(PositiveTransactions,negativeTransactions); + } + + /** + * mine exception candidates starting from positive and negative transactions + * @param PositiveTransactions + * @param negativeTransactions + * @return + * @throws IOException + */ + public List mineExceptionsAsSetManipulation(Set PositiveTransactions, Set negativeTransactions) throws IOException { + + // Get negative transactions and remove the body items + // Set negativeTransactions = getNegativeTransactions(rule); + // Disable filtering .. not required + //Collection filteredNegTrans=removeBodyItemsFromTransactions(rule, negativeTransactions); + + + // Get positive transactions and remove the body items + + //Set PositiveTransactions = getPositiveTransactions(rule); + // Disable filtering .. not required + // Collection filteredPosTrans=removeBodyItemsFromTransactions(rule, PositiveTransactions); // count items - List negTransItems = getItemsWithCount(filteredNegTrans); - List posTransItems = getItemsWithCount(filteredPosTrans); + // Disable filtering .. not required +// List negTransItems = getItemsWithCount(filteredNegTrans); +// List posTransItems = getItemsWithCount(filteredPosTrans); + + // count items + List negTransItems = getItemsWithCount(negativeTransactions); + List posTransItems = getItemsWithCount(PositiveTransactions); // Get whatever exists in negative but not head @@ -184,6 +215,9 @@ public List mineExceptionsAsSetManipulation(AssocRuleWithExceptio return diffList; } + + + private List getItemsWithCount(Collection transactions) { TIntIntHashMap itemsCount=new TIntIntHashMap(); int totalCount=0;