Giter Site home page Giter Site logo

Comments (10)

xukai92 avatar xukai92 commented on July 28, 2024

Good suggestion! Will do it along with bug fixing.

from turing.jl.

arnim avatar arnim commented on July 28, 2024

Hi,

great library!
While I'm rather new to it I stumbled upon a small issue

@model gauss1 begin
    N = length(x)
    lam = ones(Float64,N)
    mu ~ Normal(0, sqrt(1000));
    for i = 1:N
        lam[i] ~ Gamma(.001, .001)
        x[i] ~ Normal(mu, sqrt(1 / (sqrt(lam[i]))))
    end
    mu
end

x = [-27.020, 3.570, 8.191, 9.898, 9.603, 9.945, 10.056]
chain = sample(gauss1,  SMC(300))

work. However

@model gauss2 begin
    N = length(x)
    lam = ones(Float64,N)
    mu ~ Normal(0, sqrt(1000));
    
    for i = 1:N
        lam[i] ~ Gamma(.001, .001)
        x[i] ~ Normal(mu, sqrt(1 / (sqrt(lam[i]))))
    end
    mu, lam
end

chain = sample(gauss2,  SMC(300))

gives me

`
MethodError: no method matching mcmcstats(::Array{Array{Float64,1},1})
Closest candidates are:
mcmcstats{T<:Real}(::Array{T<:Real,1}) at /home/juser/.julia/v0.5/Turing/src/core/io.jl:160
mcmcstats{T<:Real}(::Array{T<:Real,2}) at /home/juser/.julia/v0.5/Turing/src/core/io.jl:168

in show(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Turing.Chain) at /home/juser/.julia/v0.5/Turing/src/core/io.jl:85
in limitstringmime(::MIME{Symbol("text/plain")}, ::Turing.Chain) at /opt/julia_packages/.julia/v0.5/IJulia/src/inline.jl:25
in display_dict(::Turing.Chain) at /opt/julia_packages/.julia/v0.5/IJulia/src/execute_request.jl:28
in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /opt/julia_packages/.julia/v0.5/IJulia/src/execute_request.jl:188
in eventloop(::ZMQ.Socket) at /opt/julia_packages/.julia/v0.5/IJulia/src/eventloop.jl:8
in (::IJulia.##13#19)() at ./task.jl:360
`

What would you recommend?
Im at the current head at a6d4cc8

Best
Arnim

from turing.jl.

yebai avatar yebai commented on July 28, 2024

Hi Arnim,

there is a small bug in the print function for Chain, which stores samples from a sampling algorithm. The following code with an extra semi-colon runs fine

chain = sample(gauss2,  SMC(300)); 

We will fix this bug in the next release.

Thanks

from turing.jl.

yebai avatar yebai commented on July 28, 2024

BTW, the current master branch contains some (major) ongoing refactoring of the interface, the result should not be trusted too much for the moment. This should gets better in the next new release.

from turing.jl.

arnim avatar arnim commented on July 28, 2024

Thanks @yebai for your quick response.
For now something like in stan-models/naive_bayes.jl:25 should do the trick of inspecting.

Let me know when I can help.
Really like the intuitive way of defining programs.

Best
Arnim

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

@yebai For more examples in the future, we can have separate files for data, model and inference, which would also make tests for front-end/interface only easy. I adapted my previous 3 Stan models following this. Please check https://github.com/xukai92/Turing-exps/tree/master/stan-models.

from turing.jl.

yebai avatar yebai commented on July 28, 2024

@xukai92 Thanks Kai. I have added some models myself. I suggest that we keep these example models under the example-models folder in the main repo for the moment. It will be easier for us to add and run these models within the main repo.

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

@yebai Agreed. I've made the update to the main repo too.

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

Goal for this isuee: make Naive Bayes and LDA work

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

Closed by PR #162

from turing.jl.

Related Issues (20)

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.