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

Add a demo model with matrix assume + individual indexing x[i][j] / tuple indexing x[i, j] #748

Open
penelopeysm opened this issue Dec 12, 2024 · 1 comment

Comments

@penelopeysm
Copy link
Member

See: #733 (comment)

When refactoring the demo models into a separate package, we should include one that has this as well.

@penelopeysm
Copy link
Member Author

(There's demo_assume_matrix_dot_observe_matrix, but it doesn't test with indexing on the LHS of a tilde)

@model function demo_assume_matrix_dot_observe_matrix(
    x=transpose([1.5 2.0;]), ::Type{TV}=Array{Float64}
) where {TV}
    n = length(x)
    d = n ÷ 2
    s ~ reshape(product_distribution(fill(InverseGamma(2, 3), n)), d, 2)
    s_vec = vec(s)
    m ~ MvNormal(zeros(n), Diagonal(s_vec))

    # Dotted observe for `Matrix`.
    x .~ MvNormal(m, Diagonal(s_vec))

    return (; s=s, m=m, x=x, logp=getlogp(__varinfo__))
end

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