Giter Site home page Giter Site logo

Comments (5)

xukai92 avatar xukai92 commented on July 28, 2024

I've looked into Distributions.jl. This error is due to the fact that helper functions for Truncated still are not defined with generic types (e.g. they use pdf(d::Truncated, x::Float64) = ... for pdf (https://github.com/JuliaStats/Distributions.jl/blob/master/src/truncate.jl). I will overload them in Turing and submit a PR soon.

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

Submitted a PR for Distributions.jl JuliaStats/Distributions.jl#586

This example below (same as above but changed β to the right support range) is passed on my local Distribution.jl fork (https://github.com/xukai92/Distributions.jl/tree/generic-support-to-truncated-dist).

using Distributions, Turing

negbindata = [0, 1, 4, 0, 2, 2, 5, 0, 1]

@model negbinmodel(y) begin
  local α, β
  α ~ Truncated(Cauchy(0,10), 0, +Inf)
  β ~ Truncated(Cauchy(0,10), 0, 1.0)
  for i = 1:length(y)
    y[i] ~ NegativeBinomial(α, β)  # α > 0, 0 < β < 1
  end
  return(α, β)
end

@sample(negbinmodel(negbindata), HMC(1000, 0.02, 1))

from turing.jl.

yebai avatar yebai commented on July 28, 2024

@xukai92
Is there anything that we can do to speed up the merging by Distributions package developers?

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

Let me chase them on the PR

from turing.jl.

xukai92 avatar xukai92 commented on July 28, 2024

Closed because PR is merged.

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.