Skip to content

A strata Split with a weight map cannot simulate from missing data #365

Open

Description

@seabbs-bot

Found while fixing #246, while checking every branch of the shape resolution.

Split(template, map) resolves a stratum count from its weight map with no data, so as_turing_model builds the right-shaped infection process for y_t = missing. The model then fails inside Split:

problem = IDProblem(
    infection = DirectInfections(;
        Z = Stratify(RandomWalk(), Hierarchy(; across = IID(Normal(0, 0.5)))),
        initialisation = Normal(log(20), 0.2)),
    observation_model = Split(PoissonError(), [1.0 1.0 1.0]),
    tspan = (1, 12))
as_turing_model(problem, (; y_t = missing))
# ERROR: A strata Split needs a NamedTuple or AbstractMatrix `y_t` to name its streams

_split_names reads the stream names off y_t, and missing names nothing. The workaround is to pass a matrix of missings of the right stream count, which is what the tests and the IDModel docstring do. That works but means the shape is being carried by a placeholder array rather than by the model.

A map fixes the stream count outright as size(map, 1), so _split_names could fall back to "group1", "group2", … for that many streams rather than erroring. That would make a mapped Split simulate the way every other observation model does.

Behaviour on main and unchanged by #363, which only resolves the shape.

This was opened by a bot. Please ping @seabbs for any questions.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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