Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binomial Distribution Errors when Probability is Float32 #1914

Open
jacobadenbaum opened this issue Nov 12, 2024 · 0 comments
Open

Binomial Distribution Errors when Probability is Float32 #1914

jacobadenbaum opened this issue Nov 12, 2024 · 0 comments

Comments

@jacobadenbaum
Copy link

MWE:

julia> using Distributions

julia> rand(Binomial(100, .3f0))
ERROR: MethodError: no method matching Distributions.BinomialTPESampler(::Int64, ::Float32)
The type `Distributions.BinomialTPESampler` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Distributions.BinomialTPESampler(::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any, ::Any)
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/samplers/binomial.jl:77
  Distributions.BinomialTPESampler(::Int64, ::Float64)
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/samplers/binomial.jl:100
  Distributions.BinomialTPESampler(::Bool, ::Int64, ::Float64, ::Float64, ::Float64, ::Float64, ::Int64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64, ::Float64)
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/samplers/binomial.jl:77
  ...

Stacktrace:
 [1] rand(rng::Random.TaskLocalRNG, d::Binomial{Float32})
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/univariate/discrete/binomial.jl:141
 [2] rand(::Binomial{Float32})
   @ Distributions ~/.julia/packages/Distributions/uuqsE/src/genericrand.jl:22
 [3] top-level scope
   @ REPL[3]:1

This should probably just convert to Float64 if it needs that under the hood, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant