Sarah Lutteropp
Sarah Lutteropp
I also printed the loglikelihood and its derivatives for the single displayed tree of the network: For partition 0: tree_logl: -418.3915497 tree_logl_prime: -11.91731155 tree_logl_prime_prime: 418.2681682 For partition 1: tree_logl: -353.5678413...
From looking at these numbers, I infer that something must have gone wrong when computing partition_logl_prime and partition_logl_prime_prime.
Formulas I used (same here for LikelihoodModel.AVERAGE and LikelihoodModel.BEST, as there is only 1 displayed tree with tree_prob 1.0): ``` partition_lh = exp(tree_logl) * tree_prob partition_lh_prime = exp(tree_logl_prime) * tree_prob...
Maybe I misunderstood these formulas from Alexeys PhD thesis, which I used for deriving the partition_logl_prime and partition_logl_prime_prime formulas? 
I got it now: My mistake was that I derived the log. Instead, one should see it as a function g. Example: Partition loglh, 2 displayed trees, LikelihoodModel.AVERAGE: logl(P) =...
Mhm. But if I follow this, then the network loglikeihood derivative is simply the sum of the partition loglikelihood derivatives... I tried this as well, but this als didn't work...
It looks much better now though. Now the error is "Exceeded maximum number of iterations" and the proposed branch lengths appear at least somewhat reasonable...
But if this is the correct network loglikelihood derivatives definition now (-> sum of partition loglikelihood derivatives, computed out of displayed tree loglikelihood derivatives), then we don't even need to...
OK it looks like I got Newton-Raphson Branch-Length optimization for networks to work. It is lots of dark voodoo though!!!
Posting the correct maths for network loglikelihood derivatives here soon. (I'm still on vacation, after all)