Likelihoods incorrectly calculated in BEAST 2.0.2

684 views
Skip to first unread message

michaelm

unread,
Nov 20, 2013, 6:27:05 AM11/20/13
to beast...@googlegroups.com
Hi all,

I'm running a very simple XML in BEAST 2.0.2 (produced with BEAUti 2.0.2), and I'm frequently seeing warnings saying "Likelihood incorrectly calculated" when using the uncorrelated exponential or uncorrelated lognormal clock (but not when using the strict clock). I'm not using BEAGLE, no add-ons, no multi-threading, just plain BEAST 2.0.2 on a Mac running Mavericks.

Even more weird, the exact same XML runs fine with BEAST 2.0.1. Using the same random number seed in BEAST 2.0.1 and 2.0.2, the posterior and likelihood values are identical for the first 23000 generations, but then start to differ. This is even before the first "Likelihood incorrectly calculated" warning appears in the BEAST 2.0.2 run. At the end of the run (after 10000000 generations), I had 8 such warnings with BEAST 2.0.2, but none with BEAST 2.0.1.

BEAST 2.0.2 runs significantly faster though than BEAST 2.0.1.

I attached the XML, the output of both 2.0.2, and 2.0.1, and the commands used to start both analyses. I would be interested to hear whether anybody can reproduce this problem. Run time is on the order of 10-20 minutes, but using this random number seed (12345), you should see the first warnings in the 2.0.2 run in the first minute (at generation 370000).

Cheers,
Michael
Archive.zip

Remco Bouckaert

unread,
Nov 20, 2013, 9:05:57 PM11/20/13
to beast...@googlegroups.com
Hi Michael,

BEAST 2 attempts to load BEAGLE by default, so the script you attached does not prevent using BEAGLE. To ensure it does not use BEAGLE, run with the -java flag, like so

java -jar -Xmx1024m beast202.jar -java -seed 12345 50genomes_simple.xml

It is slightly slower but does not produce the incorrect likelihoods.

These incorrect likelihoods pop up because every 10 thousand samples the posterior is completely recalculated and compared to the one that was incrementally calculated. The errors were a known issue with BEAGLE, but are mostly not too problematic. So far, I had not been able to find an instance that is sufficiently easy to work with and causes the problem repeatedly. With your example file I could replicate the problem comfortably and found a bug in the BEAST code that is calling BEAGLE. It is fixed in the development code -- a new release is coming soon.

Thanks for the example!

Cheers,

Remco


michaelm

unread,
Nov 21, 2013, 5:38:49 AM11/21/13
to beast...@googlegroups.com
Hi Remco,

thanks for your fast reply! I should have noticed that I'm actually using BEAGLE.
I'm glad this helped to find a bug. Good to hear that it's fixed already.

Cheers,

Michael

Andrew Rambaut

unread,
Nov 21, 2013, 10:53:59 AM11/21/13
to beast...@googlegroups.com
I would like to clarify that this is not a known issue with BEAGLE (or at least not one that has been made known to the BEAGLE developers) so I suspect Remco means it is a known issue with how BEAST uses BEAGLE. 

Andrew

--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at http://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/groups/opt_out.

___________________________________________________________________
 Andrew Rambaut                
 Institute of Evolutionary Biology       University of Edinburgh
 Ashworth Laboratories                         Edinburgh EH9 3JT
 EMAIL - a.ra...@ed.ac.uk                TEL - +44 131 6508624  

Nic

unread,
Aug 14, 2014, 8:17:48 AM8/14/14
to beast...@googlegroups.com
Hi all,

i am getting the error message
"likelihood incorrectly calculated: -infinity !.."
when running a file using the threaded treelikelihood command.
I do not get this message when I use the "normal" Treelikelihood.
Is there a way to avoid this?

Cheers,

Nic

Cymon

unread,
Nov 7, 2014, 9:00:59 AM11/7/14
to beast...@googlegroups.com
Hi Remco,

On Thursday, 21 November 2013 02:05:57 UTC, Remco Bouckaert wrote:
[cut]


These incorrect likelihoods pop up because every 10 thousand samples the posterior is completely recalculated and compared to the one that was incrementally calculated. The errors were a known issue with BEAGLE, but are mostly not too problematic. So far, I had not been able to find an instance that is sufficiently easy to work with and causes the problem repeatedly. With your example file I could replicate the problem comfortably and found a bug in the BEAST code that is calling BEAGLE. It is fixed in the development code -- a new release is coming soon.

I'm still getting similar incorrect likelihood calculations when using threads in Beagle, eg.

Likelihood incorrectly calculated: -707035.2838065105 != -992889.911565192 Operator: beast.evolution.operators.ScaleOperator

or more typically:

Likelihood incorrectly calculated: -708072.3821363244 != -Infinity Operator: beast.evolution.operators.ScaleOperator

They occur fairly randomly, and sometimes not at all, and the latter is always associated with -Infinity as the state of the first partition.

OS: CentOS 5.10
JAVA: java version "1.7.0_55"
BEAST v2.1.3, 2002-2014
Beagle revision 1260 (svn)

CMD: beast -beagle_SSE -beagle_instances 4 -threads 4 -overwrite <XML>

Data: 30 taxa, 48861 chars
Model: 11 partitions each GTR+G, log normal clock, 4 node constraints with log normal priors, fixed starting tree, no topology moves. 95 proposals in total all with good acceptances.

Regards, Cymon

Typical error:
P(posterior) = -708117.5751135679 (was -706984.524962614)
    P(prior) = -476.93780599617344 (was -476.93780599617344)
        P(YuleModel.t:tree) = -184.8051171307191 (was -184.8051171307191)
        P(YuleBirthRatePrior.t:tree) = -1.6455210284723953 (was -1.6455210284723953)
        P(GammaShapePrior.s:part1) = -0.39317595840566655 (was -0.39317595840566655)
        P(GammaShapePrior.s:part10) = -0.36057305034370946 (was -0.36057305034370946)
        P(GammaShapePrior.s:part11) = -0.3347877591443069 (was -0.3471181716473189)
        P(GammaShapePrior.s:part2) = -0.3307227926177951 (was -0.3307227926177951)
        P(GammaShapePrior.s:part3) = -0.3872018811420991 (was -0.3872018811420991)
        P(GammaShapePrior.s:part4) = -0.3819370463334154 (was -0.3819370463334154)
        P(GammaShapePrior.s:part5) = -0.37238272975836834 (was -0.3699324657618844)
        P(GammaShapePrior.s:part6) = -0.3705782635755245 (was -0.3705782635755245)
        P(GammaShapePrior.s:part7) = -0.35641406756567356 (was -0.35641406756567356)
        P(GammaShapePrior.s:part8) = -0.4059411399798457 (was -0.4059411399798457)
        P(GammaShapePrior.s:part9) = -0.3700688359728324 (was -0.3700688359728324)
        P(MutationRatePrior.s:part1) = -0.27233861601521886 (was -0.27233861601521886)
        P(MutationRatePrior.s:part10) = -0.19683322899909958 (was -0.17883461784335145)
        P(MutationRatePrior.s:part11) = -0.3076891103537601 (was -0.30117348518242565)
        P(MutationRatePrior.s:part2) = -0.336338620187483 (was -0.3484610407134247)
        P(MutationRatePrior.s:part3) = -0.2987754359364473 (was -0.2987754359364473)
        P(MutationRatePrior.s:part4) = -0.2354238057508479 (was -0.2354238057508479)
        P(MutationRatePrior.s:part5) = -0.3811363403254133 (was -0.3811363403254133)
        P(MutationRatePrior.s:part6) = -0.34972903526478505 (was -0.34972903526478505)
        P(MutationRatePrior.s:part7) = -0.2852426944560654 (was -0.27668515213902706)
        P(MutationRatePrior.s:part8) = -0.2574911532365595 (was -0.2574911532365595)
        P(MutationRatePrior.s:part9) = -0.30243226714386545 (was -0.30243226714386545)
        P(RateACPrior.s:part1) = -1.8791858337600942 (was -1.9615111685086697)
        P(RateACPrior.s:part10) = -5.604988343158037 (was -5.604988343158037)
        P(RateACPrior.s:part11) = -5.655538926766984 (was -5.655538926766984)
        P(RateACPrior.s:part2) = -5.588022887105043 (was -5.588022887105043)
        P(RateACPrior.s:part3) = -5.6951110398038525 (was -5.6951110398038525)
        P(RateACPrior.s:part4) = -5.949618395614171 (was -5.949618395614171)
        P(RateACPrior.s:part5) = -5.613606259028619 (was -5.613606259028619)
        P(RateACPrior.s:part6) = -5.853187722078925 (was -5.806427116329452)
        P(RateACPrior.s:part7) = -5.677092165125059 (was -5.677092165125059)
        P(RateACPrior.s:part8) = -5.820966588884247 (was -5.820966588884247)
        P(RateACPrior.s:part9) = -5.679619179290721 (was -5.679619179290721)
        P(RateAGPrior.s:part1) = -2.24988832171707 (was -2.24988832171707)
        P(RateAGPrior.s:part10) = -5.744716206347503 (was -5.744716206347503)
        P(RateAGPrior.s:part11) = -6.2046299098941695 (was -6.2046299098941695)
        P(RateAGPrior.s:part2) = -6.1398331128433945 (was -6.158528471100866)
        P(RateAGPrior.s:part3) = -6.007641372176666 (was -6.134898184942996)
        P(RateAGPrior.s:part4) = -5.912328214190988 (was -5.912328214190988)
        P(RateAGPrior.s:part5) = -6.152681454656774 (was -6.152681454656774)
        P(RateAGPrior.s:part6) = -6.040658503818635 (was -6.040658503818635)
        P(RateAGPrior.s:part7) = -6.243567403772296 (was -6.243567403772296)
        P(RateAGPrior.s:part8) = -5.863992005233145 (was -5.863992005233145)
        P(RateAGPrior.s:part9) = -6.12045806930204 (was -6.12045806930204)
        P(RateATPrior.s:part1) = -0.07787708420390746 (was -0.07787708420390746)
        P(RateATPrior.s:part10) = -3.701718990395591 (was -3.701718990395591)
        P(RateATPrior.s:part11) = -3.7582130278019106 (was -3.7582130278019106)
        P(RateATPrior.s:part2) = -3.701297148123677 (was -3.701297148123677)
        P(RateATPrior.s:part3) = -3.704182923067354 (was -3.704182923067354)
        P(RateATPrior.s:part4) = -3.652572569150288 (was -3.652572569150288)
        P(RateATPrior.s:part5) = -3.72399938870701 (was -3.72399938870701)
        P(RateATPrior.s:part6) = -3.3195740619813 (was -3.5622029652588014)
        P(RateATPrior.s:part7) = -3.8850117306952563 (was -3.8850117306952563)
        P(RateATPrior.s:part8) = -3.375882006684263 (was -3.375882006684263)
        P(RateATPrior.s:part9) = -3.8470524629751517 (was -3.8470524629751517)
        P(RateCGPrior.s:part1) = -1.91227239059852 (was -1.91227239059852)
        P(RateCGPrior.s:part10) = -5.385972999316177 (was -5.385972999316177)
        P(RateCGPrior.s:part11) = -5.539028043165878 (was -5.566183656655803)
        P(RateCGPrior.s:part2) = -5.672215448470372 (was -5.672215448470372)
        P(RateCGPrior.s:part3) = -5.597027956164115 (was -5.597027956164115)
        P(RateCGPrior.s:part4) = -5.41093719327957 (was -5.41093719327957)
        P(RateCGPrior.s:part5) = -5.65088385729053 (was -5.65088385729053)
        P(RateCGPrior.s:part6) = -5.6597632125134005 (was -5.6597632125134005)
        P(RateCGPrior.s:part7) = -5.7612398414626655 (was -5.7612398414626655)
        P(RateCGPrior.s:part8) = -5.402762941322875 (was -5.402762941322875)
        P(RateCGPrior.s:part9) = -5.52720924328498 (was -5.547120805190719)
        P(RateGTPrior.s:part1) = -0.2726092302170212 (was -0.2726092302170212)
        P(RateGTPrior.s:part10) = -3.5105979185110696 (was -3.5105979185110696)
        P(RateGTPrior.s:part11) = -4.178449329720856 (was -4.178449329720856)
        P(RateGTPrior.s:part2) = -3.884093069646294 (was -3.884093069646294)
        P(RateGTPrior.s:part3) = -3.9301992993313037 (was -3.9301992993313037)
        P(RateGTPrior.s:part4) = -3.440567571023324 (was -3.440567571023324)
        P(RateGTPrior.s:part5) = -4.062998280247521 (was -4.062998280247521)
        P(RateGTPrior.s:part6) = -3.8635903258197755 (was -3.8635903258197755)
        P(RateGTPrior.s:part7) = -4.1205353018433115 (was -4.1205353018433115)
        P(RateGTPrior.s:part8) = -3.8294856054113064 (was -3.8294856054113064)
        P(RateGTPrior.s:part9) = -4.1048364887423405 (was -4.1048364887423405)
        P(MeanRatePrior.c:clock) = -2.9143006077773324 (was -2.935597014677475)
        P(ucldStdevPrior.c:clock) = -4.868463808821109 (was -4.870800103371449)
        P(euphylls.prior) = -4.96340263608121 (was -4.96340263608121)
        P(landplants.prior) = -5.016175461073102 (was -5.016175461073102)
        P(sperms.prior) = -7.172043151011041 (was -7.172043151011041)
        P(traches.prior) = -3.1035794839719437 (was -3.1035794839719437)
    P(likelihood) = -707640.6373075717 (was -706507.5871566179)
        P(treeLikelihood.part1) = -62810.599815298796 (was NaN)
        P(treeLikelihood.part2) = -107959.5273645235 (was NaN)
        P(treeLikelihood.part3) = -69511.19711145655 (was NaN)
        P(treeLikelihood.part4) = -21365.44784046078 (was NaN)
        P(treeLikelihood.part5) = -87188.21846808982 (was NaN)
        P(treeLikelihood.part6) = -39176.01496622041 (was NaN)
        P(treeLikelihood.part7) = -91588.28023077076 (was NaN)
        P(treeLikelihood.part8) = -23991.90460712667 (was NaN)
        P(treeLikelihood.part9) = -90928.03303500013 (was NaN)
        P(treeLikelihood.part10) = -13836.662664512052 (was NaN)
        P(treeLikelihood.part11) = -99284.75120411217 (was NaN)
At sample 7380000



Remco Bouckaert

unread,
Nov 10, 2014, 2:26:21 PM11/10/14
to beast...@googlegroups.com
Hi Cymon,

This problem should be fixed. Are you using BEAST v2.1.3?

Cheers,

Remco

--
You received this message because you are subscribed to the Google Groups "beast-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beast-users...@googlegroups.com.
To post to this group, send email to beast...@googlegroups.com.
Visit this group at http://groups.google.com/group/beast-users.
For more options, visit https://groups.google.com/d/optout.

Cymon Cox

unread,
Nov 11, 2014, 4:38:40 AM11/11/14
to beast...@googlegroups.com
Hi Remco,

On 10 November 2014 19:26, Remco Bouckaert <higg...@gmail.com> wrote:
Hi Cymon,

This problem should be fixed. Are you using BEAST v2.1.3?

Yes.
 


OS: CentOS 5.10
JAVA: java version "1.7.0_55"
BEAST v2.1.3, 2002-2014
Beagle revision 1260 (svn)



I've attached a log file.

Cheers, C.
--

log

Cymon

unread,
Dec 17, 2014, 5:30:59 AM12/17/14
to beast...@googlegroups.com, cymo...@googlemail.com
On Tuesday, 11 November 2014 09:38:40 UTC, Cymon wrote:
Hi Remco,

On 10 November 2014 19:26, Remco Bouckaert <higg...@gmail.com> wrote:
Hi Cymon,

This problem should be fixed. Are you using BEAST v2.1.3?

Yes.

Does this imply that it was fixed in development but is known to be present in 2.1.3?

C.


 

Frank Stokvis

unread,
Feb 17, 2015, 9:17:24 AM2/17/15
to beast...@googlegroups.com, cymo...@googlemail.com
Dear Remco,

The infinite likelihood problem was still present in 2.1.0 (CIPRES) link to files. I've been investigating this problem with (a lot of) Michael's help:

- GTR with empirical base frequencies with BEAGLE: produces an infinite -likelihood at the start of the run.
- HKY with BEAGLE: produces an infinite -likelihood at the start.
- GTR without BEAGLE: the chain does not converge, not producing usable ESS values.
- HKY without BEAGLE: the chain does seem to converge.
- GTR with empirical base frequencies, without BEAGLE: the chain still does not seem to converge.

I am now running GTR with a starting tree, without BEAGLE  to see if the chain will converge; otherwise, I think I will stick with the HKY substitution model or change my partitions.

Cheers,

Frank

Op woensdag 17 december 2014 11:30:59 UTC+1 schreef Cymon:

Frank Stokvis

unread,
Feb 19, 2015, 3:49:24 AM2/19/15
to beast...@googlegroups.com, cymo...@googlemail.com
Update:

GTR with starting tree, without BEAGLE: still no convergence of the chain :(

Any suggestions?

link

Op dinsdag 17 februari 2015 15:17:24 UTC+1 schreef Frank Stokvis:

genevieve....@gmail.com

unread,
Mar 8, 2016, 5:20:30 AM3/8/16
to beast-users, cymo...@googlemail.com
Hi All,

I am having the same issue Frank describes (running HKY with Beagle on a Linux cluster), has this issue been resolved? Any guidance would be much appreciated.

Many thanks,
Genevieve
Reply all
Reply to author
Forward
0 new messages