[Biojava-dev] Bug in DP.generate()?

Matthew Pocock matthew_pocock at yahoo.co.uk
Mon May 12 11:50:52 EDT 2003


Hi David,

Sounds right to me. Oops.

M

 --- David Huen <david.huen at ntlworld.com> wrote: > Hi,
> Around line 466, the generate() method samples a
> state from the magicalState 
> and looks up the weight of that transition to add it
> to the score.
> 
>     oldState =
>
(State)model.getWeights(model.magicalState()).sampleSymbol();
>     Distribution oldDist =
> model.getWeights(oldState);
>     try {
>       symScore += oldDist.getWeight(oldState);
>     } catch (IllegalSymbolException ite) {
>       throw new BioError(ite,
>         "Transition returned from sampleTransition
> is invalid");
>     }
> 
> 
> It looks as if it is picking up the score from the
> wrong transition 
> distribution, i.e. from the transition distribution
> of the destination 
> state rather than from that of the magicalState.  At
> any rate, the current 
> code fubars immediately when the first state doesn't
> have a reflexive 
> transition.
> 
> I think the distribution line should be replaced
> by:-
>     Distribution oldDist =
> model.getWeights(model.magicalState());
> 
> Under these circumstances, I don't think we could
> ever get an 
> IllegalSymbolException (since the sampleSymbol()
> will have drawn that very 
> same distribution.) so the try clause may be
> unnecessary too.
> 
> Have I read it right?  If so, I will commit my
> changes to CVS.
> 
> Regards,
> David Huen
> 
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at biojava.org
> http://biojava.org/mailman/listinfo/biojava-dev 

__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer


More information about the biojava-dev mailing list