beast2 icon indicating copy to clipboard operation
beast2 copied to clipboard

Resuming with a RandomTree messes up the tree

Open Anaphory opened this issue 4 years ago • 2 comments

I have a file that initializes its tree with a RandomTree and some MRCA calibrations with monophyly constraints. When I resume it, the MRCA priors have a probability of 0.0 (so the logP is -Inf and the run doesn't start), because the taxa in the random tree generated before the state is read from the state file are in a different order in both runs, so the association between taxon names and node IDs is lost.

[...]
SampledNodeDateRandomWalker(TipDatesandomWalker:Passé)                              1.00000        136          2    0.01351    0.98551 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Resigaro)                           1.00000        133          5    0.01351    0.96377 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Saraveka)                           1.00000        130         11    0.01351    0.92199 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Taino)                              1.00000        128          0    0.01351    1.00000 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Uainumá)                            1.00000        118          0    0.01351    1.00000 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Uirina)                             1.00000        112          7    0.01351    0.94118 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Yabaâna)                            1.00000        124          0    0.01351    1.00000 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Yavitero)                           1.00000        164          0    0.01351    1.00000 Try setting window size to about 2
SampledNodeDateRandomWalker(TipDatesandomWalker:Old Yawalapiti)                     1.00000        144          9    0.01351    0.94118 Try setting window size to about 2

     Tuning: The value of the operator's tuning parameter, or '-' if the operator can't be optimized.
    #accept: The total number of times a proposal by this operator has been accepted.
    #reject: The total number of times a proposal by this operator has been rejected.
      Pr(m): The probability this operator is chosen in a step of the MCMC (i.e. the normalized weight).
  Pr(acc|m): The acceptance probability (#accept as a fraction of the total proposals for this operator).

Start likelihood: -Infinity 
P(posterior) = -Infinity (was -Infinity)
	P(prior) = -Infinity (was -Infinity)
		P(BirthDeath.t:tree) = -1133.2460135784913 (was -1133.2460135784913)
		P(BirthRatePrior.t:tree) = 6.628202823669165 (was 6.628202823669165)
		P(DeathRatePrior.t:tree) = -0.5949731330840248 (was -0.5949731330840248)
		P(GammaShapePrior.s:arawak) = -1.0181134859185654 (was -1.0181134859185654)
		P(AllAchagua_tipMRCA) = -Infinity (was -Infinity)
		P(Old Achagua_tipMRCA) = NaN (was NaN)  **
		P(Anauyá_tipMRCA) = NaN (was NaN)  **
		P(Apolista_tipMRCA) = NaN (was NaN)  **
		P(AllApurinã_tipMRCA) = NaN (was NaN)  **
		P(Old Apurina_tipMRCA) = NaN (was NaN)  **
[...]
	P(likelihood) = NaN (was NaN)  **
		P(treeLikelihood.arawak) = NaN (was NaN)  **
Fatal exception: Could not find a proper state to initialise. Perhaps try another seed.
See http://www.beast2.org/2018/07/04/fatal-errors.html for other possible solutions.
java.lang.RuntimeException: Could not find a proper state to initialise. Perhaps try another seed.
See http://www.beast2.org/2018/07/04/fatal-errors.html for other possible solutions.
	at beast.core.MCMC.run(Unknown Source)
	at beast.app.BeastMCMC.run(Unknown Source)
	at beast.app.beastapp.BeastMain.<init>(Unknown Source)
	at beast.app.beastapp.BeastMain.main(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at beast.app.beastapp.BeastLauncher.run(Unknown Source)
	at beast.app.beastapp.BeastLauncher.main(Unknown Source)
Fatal exception: Could not find a proper state to initialise. Perhaps try another seed.
See http://www.beast2.org/2018/07/04/fatal-errors.html for other possible solutions.
java.lang.RuntimeException: An error was encounted. Terminating BEAST
	at beast.app.util.ErrorLogHandler.publish(Unknown Source)
	at java.util.logging.Logger.log(Logger.java:738)
	at java.util.logging.Logger.doLog(Logger.java:765)
	at java.util.logging.Logger.log(Logger.java:788)
	at java.util.logging.Logger.severe(Logger.java:1464)
	at beast.app.beastapp.BeastMain.<init>(Unknown Source)
	at beast.app.beastapp.BeastMain.main(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at beast.app.beastapp.BeastLauncher.run(Unknown Source)
	at beast.app.beastapp.BeastLauncher.main(Unknown Source)

My workaround for now is to use a fixed starting tree. Maybe a fixed seed would also work. In any case, this is not “working as expected”: A -resume should be aware of the complete state, and that includes the mapping of taxon names to node IDs.

Anaphory avatar Apr 10 '21 10:04 Anaphory

Resuming with the same seed as the original run works okay, but feels very fragile.

Anaphory avatar Apr 10 '21 10:04 Anaphory

@Anaphory could you make an XML file available that behaves like this so I can investigate where things are going wrong?

rbouckaert avatar Apr 12 '21 03:04 rbouckaert