Giter Site home page Giter Site logo

junctiontrees.jl's People

Contributors

giggleliu avatar mroavi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

junctiontrees.jl's Issues

TagBot trigger issue

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!

Replace eval with macros

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)

Stack overflow during inference on julia#master due to long tuple types

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.