Skip to content

Int argument for predict function #301

@paschermayr

Description

@paschermayr

From: https://julialang.zulipchat.com/#narrow/stream/240884-soss.2Ejl

Could we have an additional argument in the predict function, where we specify the number of samples taken? We can do this already via

using Soss, Distributions
dat = randn(100)
μ₀ = 1.
σ₀ = 2.

m = @model n begin
    μ ~ Distributions.Normal()
    σ ~ Distributions.Exponential()
    data ~ Distributions.Normal(μ, σ) |> iid(n)
    return (; data)
end
post =  m((μ = μ₀, σ = σ₀, n = length(dat))) | (data = dat,)
vals = (μ = μ₀, σ = σ₀)

pred = predictive(m, keys(vals)...)
rand(pred(μ = μ₀, σ = σ₀, n = 1))

but not via the predict function itself:

Soss.predict(post, vals) #Will be A vector of length length(dat)
Soss.predict(post, vals, n = 1) #Method error

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions