Skip to content

Commit

Permalink
split the method from rules to transactions to allow integerating wit…
Browse files Browse the repository at this point in the history
…h Dang
  • Loading branch information
gadelrab committed Jul 6, 2016
1 parent b88cfc6 commit 6685c65
Showing 1 changed file with 38 additions and 4 deletions.
42 changes: 38 additions & 4 deletions src/main/java/de/mpii/frequentrulesminning/ExceptionMining.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,50 @@ public List<ItemsetString> mineExceptionsAsFrequentSetMining(AssocRuleWithExcep
return patternsFlatItems;
}


public List<ExceptionItem> mineExceptionsAsSetManipulation(AssocRuleWithExceptions rule) throws IOException {

// Get negative transactions and remove the body items
Set<Transaction> negativeTransactions = getNegativeTransactions(rule);
Collection filteredNegTrans=removeBodyItemsFromTransactions(rule, negativeTransactions);


// Get positive transactions and remove the body items
Set<Transaction> 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<ExceptionItem> mineExceptionsAsSetManipulation(Set<Transaction> PositiveTransactions, Set<Transaction> negativeTransactions) throws IOException {

// Get negative transactions and remove the body items
// Set<Transaction> negativeTransactions = getNegativeTransactions(rule);
// Disable filtering .. not required
//Collection filteredNegTrans=removeBodyItemsFromTransactions(rule, negativeTransactions);


// Get positive transactions and remove the body items

//Set<Transaction> PositiveTransactions = getPositiveTransactions(rule);
// Disable filtering .. not required
// Collection filteredPosTrans=removeBodyItemsFromTransactions(rule, PositiveTransactions);

// count items
List<ExceptionItem> negTransItems = getItemsWithCount(filteredNegTrans);
List<ExceptionItem> posTransItems = getItemsWithCount(filteredPosTrans);
// Disable filtering .. not required
// List<ExceptionItem> negTransItems = getItemsWithCount(filteredNegTrans);
// List<ExceptionItem> posTransItems = getItemsWithCount(filteredPosTrans);

// count items
List<ExceptionItem> negTransItems = getItemsWithCount(negativeTransactions);
List<ExceptionItem> posTransItems = getItemsWithCount(PositiveTransactions);


// Get whatever exists in negative but not head
Expand All @@ -184,6 +215,9 @@ public List<ExceptionItem> mineExceptionsAsSetManipulation(AssocRuleWithExceptio
return diffList;
}




private List<ExceptionItem> getItemsWithCount(Collection<Transaction> transactions) {
TIntIntHashMap itemsCount=new TIntIntHashMap();
int totalCount=0;
Expand Down

0 comments on commit 6685c65

Please sign in to comment.