in reply to Re: Problem with Statistics::Burst
in thread Problem with Statistics::Burst

Yes, I did. My entire listing is this (and the error by the way occurs when processing):
use strict; use Statistics::Burst; my $burstObj=Statistics::Burst::new(); $burstObj->generateStates(3,.111,2); $burstObj->gamma(.5); my @gap_space = (5,5,10); $burstObj->setData(\@gap_space); $burstObj->process(); my $statesUsed=$burstObj->getStatesUsed();

Replies are listed 'Best First'.
Re^3: Problem with Statistics::Burst
by rhesa (Vicar) on Feb 26, 2007 at 15:22 UTC
    Warning: I'm not a user of Statistics::Burst, nor an expert on the algorithm.

    From what I can tell by reading the source, it barfs because it passes 0 (or undef) to $obj->transistion() (sic). The reason for that, I think, is that it kicks off the calculation with $self->calcCost(11);. That hard-coded 11 is used to index into your @gap_space, so if you don't have at least 12 data points, it will fail.

    There isn't a lot of code in that module, so I suggest you patch it up and create an RT ticket. It can use some attention.

    update: I tried it with some random input, and because of that hard-coded 11, $obj->getStatesUsed(); will only ever return 12 states. IMHO you'd be better off just re-implementing the algorithm yourself.