cscherrer / Tilde.jl

WIP successor to Soss.jl
MIT License
74 stars 1 forks source link

Contexts #32

Closed cscherrer closed 2 years ago

cscherrer commented 2 years ago

@mschauer I finally got DAGs working, at least as a prototype. Here's a tiny example:

julia> m = @model begin
    p ~ Uniform()
    q = 1-p
    y ~ Bernoulli(q)
end;

julia> dag = getdag(m(), rand(m()))
Meta graph based on a Graphs.SimpleGraphs.SimpleDiGraph{Int64}(1, [[2], Int64[]], [Int64[], [1]]) with vertex labels of type Tuple{Symbol, Any}, vertex metadata of type Nothing, edge metadata of type Nothing, graph metadata given by nothing, and default weight 1.0

julia> dag.graph
{2, 1} directed simple Int64 graph

The rand(m()) tells it what parameters to use. We can add a method to use testvalue(m()) by default.