mroavi / junctiontrees.jl Goto Github PK
View Code? Open in Web Editor NEWA metaprogramming-based implementation of the junction tree algorithm.
License: MIT License
A metaprogramming-based implementation of the junction tree algorithm.
License: MIT License
I am reading this documentation page, but I can not reproduce it without model data
https://mroavi.github.io/JunctionTrees.jl/stable/usage/
I would be great if the asia
dataset can be in the examples folder.
The file IO is used in another package. Moving uai
files and its reading functions to another package will make the dependency smaller.
https://github.com/mroavi/TensorInference.jl
This design pattern is similar to GraphIO: https://github.com/JuliaGraphs/GraphIO.jl that loads graphs from disk.
MetaGraphsNext.jl is an experimental, type-stable replacement for MetaGraphs.jl.
The OMEinsum boost optimization uses MLStyle.jl. Consider replacing the usage of MacroTools.jl's macros with MLStyle.jl.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
OMEinsum has a much better performance than the default backend in place.
Instead, assume that they start from 0, just like they are defined in the UAI evid file.
I probably made this assumption because it plays nicely with the redu
function.
The minimum fix should be like
using JunctionTrees
problem_number = "34"
problem_filename = joinpath("Promedus_" * problem_number)
problem_dir = joinpath(@__DIR__, "../examples/problems/Promedus/", problem_number)
uai_filepath = joinpath(problem_dir, problem_filename * ".uai")
uai_evid_filepath = joinpath(problem_dir, problem_filename * ".uai.evid")
uai_mar_filepath = joinpath(problem_dir, problem_filename * ".uai.MAR")
td_filepath = joinpath(problem_dir, problem_filename * ".tamaki.td")
reference_marginals = JunctionTrees.read_uai_mar_file(uai_mar_filepath)
obsvars, obsvals = JunctionTrees.read_uai_evid_file(uai_evid_filepath)
# ------------------------------------------------------------------------------
# Posterior marginals given evidence
# ------------------------------------------------------------------------------
macro inferencemodel(uai_filepath, uai_evid_filepath)
compile_algo(
eval(uai_filepath),
uai_evid_filepath = eval(uai_evid_filepath),
)
end
algo = @inferencemodel uai_filepath uai_evid_filepath
marginals = algo(obsvars, obsvals) |> x -> map(y -> y.vals, x)
During testing of this package (specifically, as part of the compile algorithm
testset while compiling run_algo(Array{Int64, 1}, Array{Int64, 1})
), inference is being invoked with very long tuple types:
Internal error: stack overflow in type inference of run_algo(Array{Int64, 1}, Array{Int64, 1}).
This might be caused by recursion over very long tuples or argument lists.
(rr) call jl_(types)
Tuple{typeof(Base.promote_typeof), Vararg{JunctionTrees.Factor{Float64, _A} where _A, 249}}
(the max number of args is much higher; this is just at some point during the backtrace.)
Invoking inference with such types is generally not OK, and here causes a stack overflow after recursing >10000 frames deep. I'm assuming somewhere a long list of values is being accidentally splat into a function invocation.
If you think this specific case should be supported, please reduce it to a minimal example and open an issue on the Julia repository. In the meantime, I'll assume this is a bug in the package, and will temporarily blacklist it in PkgEval.jl.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.