tree_inference.tppl
function buildForest
Build forest of trees from leaves, recursively
function buildForest(data: Int[][], forest: SeqTree[], index: Int, dataLen: Int) => SeqTree[]
function cluster
function cluster(q: Matrix[Real], trees: SeqTree[], maxAge: Real, seqLen: Int) => SeqTree[]
function ctmc
Note: this is not optimal, in terms of repeated calculation of matrix exp
function ctmc(initialstate: Int, q: Matrix[Real], t: Real) => Real[]
function myModel
model function myModel(data: Int[][]) => SeqTree[]
function pickpair
Randomly sample two indices in the trees vector, to be combined. Avoiding mirror cases.
function pickpair(n: Int) => Int[]
type SeqTree
type SeqTree =
| Leaf {age: Real, seq: Int[]}
| Node {age: Real, seq: Int[], left: SeqTree, right: SeqTree}