Skip Menu |

This queue is for tickets about the Tree-FP CPAN distribution.

Report information
The Basics
Id: 89643
Status: new
Priority: 0/
Queue: Tree-FP

People
Owner: Nobody in particular
Requestors: mlsgisanalyst [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Missing itemset
Date: Mon, 21 Oct 2013 01:21:57 +0300
To: bug-Tree-FP [...] rt.cpan.org
From: Peter Tsolakis <mlsgisanalyst [...] gmail.com>
Take this list of transactions, stored in file.txt: 1 2 3 4 5 6 4 6 9 6 8 7 2 4 3 6 7 And run the following script. It will throw an "Illegal division by zero at Tree/FP.pm line 388." when calling the association_rules method. By debugging a little bit, it seems that the _fp_growth sub in some circumstances might miss a set (in this case, with support=0.3, it misses the {'3'} set). #!/usr/bin/perl use warnings; use strict; use Tree::FP; use POSIX qw(ceil); my %words; { open (my $IN,'<','file.txt') or die $!; while (<$IN>) { chomp; $words{$_}++ for split/ /; } close $IN; } my @sorted=sort {$words{$b}<=>$words{$a}} keys %words; my $fptree=Tree::FP->new(@sorted); $fptree->set_support(0.3); $fptree->set_confidence(0.6); { open (my $IN,'<','file.txt') or die $!; while (<$IN>) { chomp; $fptree->insert_tree(split/ /) or die "Error while insert row $.: ",$fptree->err; } close $IN; } my @rules=$fptree->association_rules;