Skip to content

Stan: arrays with nested tuples break stan interface #207

@aseyboldt

Description

@aseyboldt

This currently throws an error when parsing the stan variable names:

import nutpie

code = """
parameters {
    array[2, 3] tuple(matrix[5, 7], real) yi;
}
model {
    for (i in 1:2) {
        for (j in 1:3) {
            yi[i, j].2 ~ normal(-j - 3 * i, 0.1);
            for (k in 1:5) {
                for (m in 1:7) {
                    yi[i, j].1[k, m] ~ normal(m + 7 * k + 7 * 5 * j + 7 * 5 * 3 * i, 0.1);
                }
            }
        }
    }
    
}
"""

compiled = nutpie.compile_stan_model(code=code)

tr = nutpie.sample(compiled)

means = tr.posterior.mean(["draw", "chain"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions