Skip to content

Handler to replace sample sites with different distribution #2118

@tilmantroester

Description

@tilmantroester

My (limited) understanding is that lift allows me to change param sites into sample sites, while substitute replaces sample sites with fixed values. Is there an effect handler that allows me to replace sample sites with other distributions? I thought this might be useful when exploring different priors for a model.

I had a quick stab at naively merging the lift and substitute handlers by adding

if isinstance(value, numpyro.distributions.Distribution):
    msg["fn"] = value

to substitute.process_message.

This seems to work but I don't know enough about numpyro to judge where this might break. lift also has some _samples_cache functionality that's missing here. Is there a reason substitute doesn't already support this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions