oryx.core.ppl.graph_replace

Transforms a program to one with new inputs and outputs.

graph_replace enables redefining the inputs and outputs of a probabilistic program that samples latent random variables. It takes a program, along with a list of input names and output names, and returns a function from the random variables corresponding to the input names to the ones corresponding to the output names.

f A probabilistic program.
input_names A string or list of strings that correspond to random variables.
output_names A string or list of strings that correspond to random variables.

A probabilistic program that maps the random variables corresponding to the input names to those of the output names.