Modeling how-to question

Hi, I’m having trouble figuring out how to model a situation. It seems pretty simple; here’s an analog:

Imagine we want to know how many elves there are in a forest and how many modifications to the forest they have made. There are two modifications an elf can make: painting a rock or carving a tree stump. Each day, an elf can choose either to paint a rock or carve a tree stump. We can only partially observe the forest. If we see a lot of elves, we can infer that there will be a lot painted rocks or carved tree stumps or both. If we see a lot of painted rocks, we can infer there are lots of elves. If we are certain of the number of elves, then seeing a lot of painted rocks means there are fewer carved tree stumps.

We would create a variable num_of_elves and each would have a binomial distribution leading to num_painted_rocks and num_carved_wood?

Sorry for the long question for a simple model. Any pointers to any help would be appreciated.

I guess we could create a model like this

expected_num_elves = 7
days_since_elves_entered_forest = 5

def model():
    num_elves = pyro.sample("num_elves",
    # Let's assume that elves are identical so we can aggregate
    # all elves x days into a single Binomial.
    num_mods = num_elves * num_days

    prefer_rocks = pyro.sample("prefer_rocks", dist.Beta(2, 2))
    num_painted_rocks = pyro.sample("num_painted_rocks",
                                    dist.Binomial(num_mods, prefer_rocks))
    pyro.deterministic("num_carved_wood", num_mods - num_painted_rocks)

and then we can either estimate the number of elves given number of painted rocks

pyro.condition(model, num_painted_rocks=10)

or estimate the number of carved stumps (which should be deterministic)

pyro.condition(model, num_elves=7, num_painted_rocks=10)

I agree this is a little unsatisfying since the model is not symmetric, but Pyro’s dist.Multinomial doesn’t have support for partial observations. Can you say a little more about what you want to do with the models?

1 Like

Thanks! I’ll play around with that model and think it over.