Skip to main content

tree_inference_pruning.tppl

function build_forest​

Build forest of trees from leaves, recursively

function build_forest(data: Int[][], forest: MsgTree[], index: Int, data_len: Int, seq_len: Int) => MsgTree[]

function cluster​

KEY FUNCTION: CLUSTER

function cluster(q: Matrix[Real], trees: MsgTree[], maxAge: Real, seq_len: Int) => MsgTree[]

function get_leaf_message​

Get message from leaves for each site

function get_leaf_message(seq: Int) => Matrix[Real]

function get_log_likes​

Compute log likelihood for each site

function get_log_likes(msg: Matrix[Real]) => Real

type MsgTree​

type MsgTree =
| Leaf {age: Real, index: Int, msg: Matrix[Real][]}
| Node {age: Real, msg: Matrix[Real][], left: MsgTree, right: MsgTree}

function myModel​

model function myModel(data: Int[][]) => MsgTree[]

function pickpair​

Randomly sample two indices in the trees vector, to be combined. Avoiding mirror cases.

function pickpair(n: Int) => Int[]