Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruleSet is null #3

Closed
nirehs opened this issue Jul 31, 2017 · 1 comment
Closed

ruleSet is null #3

nirehs opened this issue Jul 31, 2017 · 1 comment
Assignees
Labels

Comments

@nirehs
Copy link

nirehs commented Jul 31, 2017

Junit test code is:

File inputFile = new File("c:/data1.txt");
double minSupport = 0.1;
double minConfidence = 0.2;
Apriori<NamedItem> apriori = new Apriori.Builder<NamedItem>(minSupport)
    .generateRules(minConfidence).create();
Iterator<Transaction<NamedItem>> iterator = new DataIterator(inputFile);
Output<NamedItem> output = apriori.execute(iterator);
RuleSet<NamedItem> ruleSet = output.getRuleSet();
		
if (ruleSet != null) {
    Iterator<AssociationRule<NamedItem>> iteratorItemSet = ruleSet.iterator();

    while (iteratorItemSet.hasNext()) {
        AssociationRule<NamedItem> itemSet = iteratorItemSet.next();
        System.out.println("result ............." + itemSet.toString());
    }
} else {
    System.out.println("ruleSet is null");
}

data1.txt content is:

bread   butter  sugar
coffee  milk    sugar
bread   coffee  milk    sugar
coffee  milk

run result is :

ruleSet is null

the support of "coffee milk " is 3/4=0.75, the confidence is 3/3=1,accord with minSupport = 0.1 and minConfidence = 0.2,ruleSet should has "coffee -> milk" at least.

@michael-rapp
Copy link
Owner

Fixed in version 1.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants